Skip to content
  • 1 Votes
    1 Posts
    407 Views
    No one has replied
  • 0 Votes
    9 Posts
    2k Views
    J

    Thanks again for your input @tekojo. I'm not 100% sure on the gloves just yet, likely a mixture of synthetic, leather and suede. I'll keep the sliders for now, and will give them a thorough test once my hardware is setup.

  • 0 Votes
    6 Posts
    3k Views
    E

    @tansgumus said in Button backgound non-existent property!:

    Component.onCompleted: { // WORKS! // button.background.color = "red" // WRONG background = Rectangle { color: "red" } }

    Because Component.onCompleted is a javascript function and you can use only js syntax inside it. Rectangle { color: "red" } is QML specific syntax, js doesn't understand it. You can create a component dynamically (see the QML docs) by giving the component as a string to Qt.createQmlObject().

    If you use button.background.color = "red" in Component.onCompleted it retains all other properties of the backround; I have found it to be a convenient way to change only one or two properties without messing others. Using other approaches, i.e. defining the whole component either dynamically or declaratively, overwrites everything which may or may not be desirable.