QML property binding depending on an other binding in the same component

Silex

Let's say I have a QtObject, which has some properties. Are there any drawbacks using a binding in an other binding in the same QtObject:

QtObject {
    // This is set by the caller
    property var myObject

    readonly property bool haveMyObject: myObject ? true :  false
    readonly property bool isSomething1: haveMyObject ? myObject.isSomething1 :  false
    readonly property bool isSomething2: haveMyObject ? myObject.isSomething2 :  false
    readonly property bool isSomething3: haveMyObject ? myObject.isSomething3 :  false
    readonly property bool isSomething4: haveMyObject ? myObject.isSomething4 :  false
    readonly property bool isSomething5: haveMyObject ? myObject.isSomething5 :  false
}

instead of this:

QtObject {
    // This is set by the caller
    property var myObject

    readonly property bool haveMyObject: myObject ? true :  false
    readonly property bool isSomething1: myObject ? myObject.isSomething1 :  false
    readonly property bool isSomething2: myObject ? myObject.isSomething2 :  false
    readonly property bool isSomething3: myObject ? myObject.isSomething3 :  false
    readonly property bool isSomething4: myObject ? myObject.isSomething4 :  false
    readonly property bool isSomething5: myObject ? myObject.isSomething5 :  false
}

Which one is preferable? The reason why I am asking is because by the Qt docs the order of evaluation is undefined.

Kuba hasn't forgotten Monica

It is not true that the order is fully undefined. The bindings are evaluated in an order defined by their dependency relationships. For any dependant-dependency pair, it is guaranteed that the dependency side is evaluated before dependant. Thus, every isSomething property is evaluated/updated after it dependency haveMyObject has been evaluated/updated.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Binding property of child property in qml

From Dev

DataTemplate Binding depending on property type and with working property Binding

From Dev

Binding property to visibility of other element

From Dev

QML scope: property binding in child object failing

From Dev

QML scope: property binding in child object failing

From Dev

QML Binding with Javascript array access to QObject Property

From Dev

Binding to a component property in angular2

From Dev

Bidirectional data binding on a component input property

From Dev

Inter component property binding in Angular 2

From Dev

Signaling to users of component that binding a property is not safe

From Dev

Refresh binding with converter bound to other property

From Dev

Binding CommandParameters to Property from other View

From Dev

WPF binding to the same property of multiple objects in a collection

From Dev

Change Binding depending on RadioButton

From Dev

Is it legal to assign to property that already has binding defined in QML

From Dev

Angular property binding target can change component property

From Dev

QML binding to an array element

From Dev

QML binding not updating

From Dev

Binding f:viewParam on component binding

From Dev

Binding c# Property to a different Property on the SAME control

From Dev

Binding a property with is not a dependency property

From Dev

extjs 5 : make a data binding for component's custom property

From Dev

2-Way Binding a Property of a Component in Angular 2

From Dev

How to pass data to the input in angular html component using property binding

From Dev

Angular 2: Parent-Child Component Property Binding

From Dev

Cancel binding depending on object type

From Dev

Cancel binding depending on object type

From Dev

Binding event to other UI component's function, in Kendo MVVM

From Dev

Binding not working on a single property of an object (while other properties are working)

Related Related

  1. 1

    Binding property of child property in qml

  2. 2

    DataTemplate Binding depending on property type and with working property Binding

  3. 3

    Binding property to visibility of other element

  4. 4

    QML scope: property binding in child object failing

  5. 5

    QML scope: property binding in child object failing

  6. 6

    QML Binding with Javascript array access to QObject Property

  7. 7

    Binding to a component property in angular2

  8. 8

    Bidirectional data binding on a component input property

  9. 9

    Inter component property binding in Angular 2

  10. 10

    Signaling to users of component that binding a property is not safe

  11. 11

    Refresh binding with converter bound to other property

  12. 12

    Binding CommandParameters to Property from other View

  13. 13

    WPF binding to the same property of multiple objects in a collection

  14. 14

    Change Binding depending on RadioButton

  15. 15

    Is it legal to assign to property that already has binding defined in QML

  16. 16

    Angular property binding target can change component property

  17. 17

    QML binding to an array element

  18. 18

    QML binding not updating

  19. 19

    Binding f:viewParam on component binding

  20. 20

    Binding c# Property to a different Property on the SAME control

  21. 21

    Binding a property with is not a dependency property

  22. 22

    extjs 5 : make a data binding for component's custom property

  23. 23

    2-Way Binding a Property of a Component in Angular 2

  24. 24

    How to pass data to the input in angular html component using property binding

  25. 25

    Angular 2: Parent-Child Component Property Binding

  26. 26

    Cancel binding depending on object type

  27. 27

    Cancel binding depending on object type

  28. 28

    Binding event to other UI component's function, in Kendo MVVM

  29. 29

    Binding not working on a single property of an object (while other properties are working)

HotTag

Archive