Module qtjambi
Package io.qt.core

Class QBindable<T>

All Implemented Interfaces:
QtObjectInterface, Cloneable

public final class QBindable<T>
extends QUntypedBindable

Java wrapper for Qt class QBindable

Use QBindable to make a QObject.QProperty field available as bindable QMetaProperty.

Example:

public class MyObject extends QObject{
    private final QProperty<QColor> color = new QProperty<>();
    
    public QColor color(){
        return color.value();
    }
    
    public void setColor(QColor color){
        color.setValue(color);
    }
    
    public QBindable<QColor> bindableColor(){
        return new QBindable<>(color);
    }
}

To let QtJambi's metaobject system identify a method as bindable getter the method meets following signature and naming convention:

  1. returns QUntypedBindable or a subtype of QUntypedBindable
  2. no parameters
  3. method name is "bindableFoo" for an available property "foo" whereas "foo" can be any name

If the bindable getter's name does not meet the upper naming convention use the QtPropertyBindable annotation instead and specify the property's name by the annotation's QtPropertyBindable.name() attribute.

Alternatively, it is possible to declare a QObject.QProperty field public or by using the QtPropertyMember annotation. In this case, QBindable is supplied automatically:

public class MyObject extends QObject{
    @QtPropertyMember
    private final QProperty<QColor> color = new QProperty<>();
}

For primitive-typed implementations of QBindable see:

See Also:
QtPropertyBindable, QObject.QProperty, QMetaProperty.isBindable(), QMetaProperty.bindable(QObject)