How to change property of other objects in QML

meaning-matters

I have the following in a bb.cascades QML file:

   Container {
        id: rangeSelector

        bottomPadding: 5
        layout: StackLayout {
            orientation: LayoutOrientation.LeftToRight
        }

        Container {
            Button {        
                id: buttonA            
                text : "1D"
                opacity: 1.0
            }
        }

        Container {
            Button {
                id: buttonB            
                text : "5D"
                opacity: 0.5
            }
        }
    }

How do I change the opacity of buttonA, when buttonB is tapped?

I'm totally new to QML, read some BB10 cascades documentation, but can't find how to hook things like this up.

My goal of this question is to understand how to, in general, change things in other 'objects' on a tap or change inside another. But I do have the above issue (but then with 6 buttons instead of 2; trying to create a kind of SegmentControl with more than 4 segments).

meaning-matters

It was quite simple:

Container {
    Button {        
        id: buttonA            
        text : "1D"
        opacity: 1.0
        onClicked: {
            buttonA.opacity = 1.0
            buttonB.opacity = 0.5
        }
    }
}

Container {
    Button {
        id: buttonB            
        text : "5D"
        opacity: 0.5
        onClicked: {
            buttonA.opacity = 0.5
            buttonB.opacity = 1.0
        }
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to change a property of a object in QML upon a hover?

From Dev

How To Change A Property In An Array Of Objects

From Dev

How to re-evaluate c++ function bound to qml property on dependent property change?

From Dev

How to re-evaluate c++ function bound to qml property on dependent property change?

From Dev

QML how to animate every change of a property? (only the last change animation is visible)

From Dev

How to propagate property change notifications of objects within collections

From Dev

How can I change the name property of the objects in my mutable array?

From Dev

Change property of the QML singleton with C++

From Dev

Change property of the QML singleton with C++

From Dev

How to animate multiple objects in qml

From Dev

QML: How to wait until a component is re-drawn due to property change?

From Dev

QML not registering property change from C++ property

From Dev

How to rank objects by property?

From Dev

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

From Dev

How to access a component bound to a property in QML

From Dev

How to expose property of QObject pointer to QML

From Dev

How to set property type of qml signal?

From Dev

QML: How to reset item property to defaut

From Dev

How do you check if a property is undefined in qml?

From Dev

How to set property type of qml signal?

From Dev

How to make visible property work immediately in QML?

From Dev

How to access "ApplicationWindow" reference in other QML file?

From Dev

How to modify QML dynamic objects from JavaScript

From Dev

How to modify QML dynamic objects from JavaScript

From Dev

javascript, node, generate object property from other objects property, or default

From Dev

How to change a property in for loop

From Dev

How change the property of gridslide

From Dev

Change property or apply event to multiple objects in jQuery

From Dev

Change the property of objects in a List using LINQ

Related Related

  1. 1

    How to change a property of a object in QML upon a hover?

  2. 2

    How To Change A Property In An Array Of Objects

  3. 3

    How to re-evaluate c++ function bound to qml property on dependent property change?

  4. 4

    How to re-evaluate c++ function bound to qml property on dependent property change?

  5. 5

    QML how to animate every change of a property? (only the last change animation is visible)

  6. 6

    How to propagate property change notifications of objects within collections

  7. 7

    How can I change the name property of the objects in my mutable array?

  8. 8

    Change property of the QML singleton with C++

  9. 9

    Change property of the QML singleton with C++

  10. 10

    How to animate multiple objects in qml

  11. 11

    QML: How to wait until a component is re-drawn due to property change?

  12. 12

    QML not registering property change from C++ property

  13. 13

    How to rank objects by property?

  14. 14

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

  15. 15

    How to access a component bound to a property in QML

  16. 16

    How to expose property of QObject pointer to QML

  17. 17

    How to set property type of qml signal?

  18. 18

    QML: How to reset item property to defaut

  19. 19

    How do you check if a property is undefined in qml?

  20. 20

    How to set property type of qml signal?

  21. 21

    How to make visible property work immediately in QML?

  22. 22

    How to access "ApplicationWindow" reference in other QML file?

  23. 23

    How to modify QML dynamic objects from JavaScript

  24. 24

    How to modify QML dynamic objects from JavaScript

  25. 25

    javascript, node, generate object property from other objects property, or default

  26. 26

    How to change a property in for loop

  27. 27

    How change the property of gridslide

  28. 28

    Change property or apply event to multiple objects in jQuery

  29. 29

    Change the property of objects in a List using LINQ

HotTag

Archive