QUntypedBindable Class
QUntypedBindableは、任意の型T
のQProperty\<T\>
やQObjectBindableProperty
のようなバインド可能なプロパティに対する統一インターフェースです。さらに...
ヘッダ | #include <QUntypedBindable> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
以来: | Qt 6.0 |
継承元: |
パブリック関数
QUntypedBindable() | |
QUntypedBindable(Property *property) | |
QPropertyNotifier | addNotifier(Functor f) |
QUntypedPropertyBinding | binding() const |
bool | hasBinding() const |
(since 6.1) bool | isReadOnly() const |
bool | isValid() const |
QUntypedPropertyBinding | makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const |
(since 6.2) QMetaType | metaType() const |
QPropertyChangeHandler<Functor> | onValueChanged(Functor f) const |
bool | setBinding(const QUntypedPropertyBinding &binding) |
QPropertyChangeHandler<Functor> | subscribe(Functor f) const |
(since 6.1) QUntypedPropertyBinding | takeBinding() |
詳しい説明
QUntypedBindableは、バインド可能なプロパティをラップするための完全に型消去された汎用インターフェイスです。このインターフェイスを使用することで、プロパティの型やバインド可能なプロパティの種類を意識することなく、プロパティと対話することができます(例:QProperty やQObjectBindableProperty)。ほとんどの使用例では、QBindable<T>(プロパティの実装の上に汎用的ですが、固定型を持っています)を使用することをお勧めします。
メンバ関数のドキュメント
[constexpr noexcept]
QUntypedBindable::QUntypedBindable()
Default-QUntypedBindableを構築します。無効な状態です。
isValid()も参照してください 。
template <typename Property> QUntypedBindable::QUntypedBindable(Property *property)
プロパティproperty からQUntypedBindableを構築します。Propertyがconstの場合、QUntypedBindableは読み取り専用となります。property がnullの場合、QUntypedBindableは無効です。
isValid() およびisReadOnly()も参照してください 。
template <typename Functor> QPropertyNotifier QUntypedBindable::addNotifier(Functor f)
f を変更ハンドラとしてインストールします。基になるプロパティが変更されると、返されるQPropertyNotifier
とプロパティが生きている限り、f が呼び出されます。
このメソッドは、返されるオブジェクトがテンプレートではないため、onValueChanged ()よりも使いやすい場合があります。そのため、クラスのメンバなどとして、より簡単に格納することができます。
onValueChanged() およびsubscribe()も参照 。
QUntypedPropertyBinding QUntypedBindable::binding() const
基礎となるプロパティのバインディングがあればそれを返し、なければデフォルトで構築されたQUntypedPropertyBindingを返します。
setBinding() およびhasBinding()も参照してください 。
bool QUntypedBindable::hasBinding() const
基礎となるプロパティにバインディングがある場合はtrue
を返します。
[since 6.1]
bool QUntypedBindable::isReadOnly() const
QUntypedBindable が読み取り専用であれば true を返します。
この関数は Qt 6.1 で導入されました。
bool QUntypedBindable::isValid() const
QUntypedBindable が有効な場合、true を返す。無効なQUntypedBindable に対して呼び出されたメソッドは、特に断りのない限り、通常何の効果もない。
QUntypedPropertyBinding QUntypedBindable::makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const
指定 し た ソ ースlocation を用いて、 その基礎 と な る プ ロ パテ ィ の値を返すバ イ ンデ ィ ン グ を作成 し ます。
[since 6.2]
QMetaType QUntypedBindable::metaType() const
QUntypedBindable が作成 さ れたプ ロパテ ィ の メ タ タ イ プを返 し ます。バインダブルが無効な場合は、無効なメタタイプが返されます。
この関数は Qt 6.2 で導入されました。
isValid()も参照してください 。
template <typename Functor> QPropertyChangeHandler<Functor> QUntypedBindable::onValueChanged(Functor f) const
f を変更ハンドラとしてインストールします。基になるプロパティが変更されると、返されるQPropertyChangeHandler
とプロパティが生きている限り、f が呼び出されます。値が変更されるたびに、ハンドラは即座に呼び出されるか、コンテキストに応じて遅延されます。
onValueChanged() およびsubscribe()も参照してください 。
bool QUntypedBindable::setBinding(const QUntypedPropertyBinding &binding)
基 礎プ ロ パテ ィ のバ イ ンデ ィ ン グ をbinding に設定 し ます。 こ れは、QUntypedBindable が読み取 り 専用の場合、 null の場合、 ま たはbinding の型が基 礎プ ロ パテ ィ の型 と 一致 し てい る 場合には効力を持ち ません。
バインディングが正常に設定された場合はtrue
を返します。
binding()も参照してください 。
template <typename Functor> QPropertyChangeHandler<Functor> QUntypedBindable::subscribe(Functor f) const
onValueChanged(f)
に続くf への呼び出しのように動作する、
onValueChanged()も参照のこと 。
[since 6.1]
QUntypedPropertyBinding QUntypedBindable::takeBinding()
現在設定されているバインディングをプロパティから削除して返します。バインディングが設定されていない場合、デフォルトのQUntypedPropertyBindingを返します。
この関数はQt 6.1で導入されました。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.