Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Common properties across a number of controls?
Forum Updated to NodeBB v4.3 + New Features

Common properties across a number of controls?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 119 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alan B
    wrote on last edited by
    #1

    Is it possible to define a 'style' and then use that style across a number of controls?
    For example, if I have a number of labels and I want them all to have the same alignment and anchors like so:

    Label {
         anchors.fill: parent
         horizontalAlignment: Text.AlignHCenter
         text: "Text"
    }
    

    Can I create a 'style' to specify these property values and then call that 'style' either for all controls of type Label or, if not, refer to the 'style' as a property of each Label, rather than having to specify the property values in every control.

    Hope that makes sense ? :-)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved