En esta página

QUntypedBindable Class

QUntypedBindable es una interfaz uniforme sobre propiedades vinculables como QProperty\<T\> y QObjectBindableProperty de cualquier tipo T. Más...

Cabecera: #include <QUntypedBindable>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Desde: Qt 6.0
Heredado por:

QBindable

Funciones Públicas

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()

Descripción Detallada

QUntypedBindable es una interfaz genérica completamente borrada de tipo para envolver propiedades enlazables. Puede utilizarla para interactuar con propiedades sin conocer su tipo ni saber qué tipo de propiedad vinculable son (por ejemplo, QProperty o QObjectBindableProperty). Para la mayoría de los casos de uso, es preferible utilizar QBindable<T> (que es genérico sobre la implementación de la propiedad pero tiene un tipo fijo).

Documentación de funciones miembro

[constexpr noexcept] QUntypedBindable::QUntypedBindable()

Default-construye un QUntypedBindable. Se encuentra en un estado inválido.

Véase también isValid().

template <typename Property> QUntypedBindable::QUntypedBindable(Property *property)

Construye un QUntypedBindable a partir de la propiedad property. Si Property es const, el QUntypedBindable será de sólo lectura. Si property es null, el QUntypedBindable no será válido.

Véase también isValid() y isReadOnly().

template <typename Functor> QPropertyNotifier QUntypedBindable::addNotifier(Functor f)

Instala f como gestor de cambios. Cada vez que la propiedad subyacente cambie, se llamará a f, siempre que el objeto devuelto QPropertyNotifier y la propiedad se mantengan vivos.

Este método es en algunos casos más fácil de usar que onValueChanged(), ya que el objeto devuelto no es una plantilla. Por lo tanto, puede almacenarse más fácilmente, por ejemplo, como miembro de una clase.

Véase también onValueChanged() y subscribe().

QUntypedPropertyBinding QUntypedBindable::binding() const

Devuelve el enlace de la propiedad subyacente si existe, o un QUntypedPropertyBinding construido por defecto en caso contrario.

Véase también setBinding() y hasBinding().

bool QUntypedBindable::hasBinding() const

Devuelve true si la propiedad subyacente tiene un enlace.

[since 6.1] bool QUntypedBindable::isReadOnly() const

Devuelve true si QUntypedBindable es de sólo lectura.

Esta función se introdujo en Qt 6.1.

bool QUntypedBindable::isValid() const

Devuelve true si QUntypedBindable es válido. Los métodos invocados en un QUntypedBindable inválido generalmente no tienen efecto, a menos que se indique lo contrario.

QUntypedPropertyBinding QUntypedBindable::makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const

Crea un enlace que devuelve el valor de las propiedades subyacentes, utilizando una fuente especificada location.

[since 6.2] QMetaType QUntypedBindable::metaType() const

Devuelve el metatipo de la propiedad a partir de la cual se creó QUntypedBindable. Si el bindable es inválido, se devolverá un metatype inválido.

Esta función se introdujo en Qt 6.2.

Véase también isValid() y QUntypedPropertyBinding::valueMetaType().

template <typename Functor> QPropertyChangeHandler<Functor> QUntypedBindable::onValueChanged(Functor f) const

Instala f como gestor de cambios. Cada vez que cambie la propiedad subyacente, se llamará a f, siempre que el QPropertyChangeHandler devuelto y la propiedad se mantengan vivos. En cada cambio de valor, el manejador es llamado inmediatamente, o diferido, dependiendo del contexto.

Véase también QProperty::onValueChanged() y subscribe().

bool QUntypedBindable::setBinding(const QUntypedPropertyBinding &binding)

Establece el enlace de la propiedad subyacente a binding. Esto no tiene ningún efecto si QUntypedBindable es de sólo lectura, nulo o si el tipo de binding coincide con el tipo de la propiedad subyacente.

Devuelve true cuando el enlace se ha establecido correctamente.

Véase también binding() y QUntypedPropertyBinding::valueMetaType().

template <typename Functor> QPropertyChangeHandler<Functor> QUntypedBindable::subscribe(Functor f) const

Se comporta como una llamada a f seguida de onValueChanged(f),

Véase también onValueChanged().

[since 6.1] QUntypedPropertyBinding QUntypedBindable::takeBinding()

Elimina la vinculación actual de la propiedad y la devuelve. Devuelve un QUntypedPropertyBinding construido por defecto si no se ha establecido ningún enlace.

Esta función se introdujo en Qt 6.1.

© 2026 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.