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. Style Settings in Qt Quick (+ Designer)

Style Settings in Qt Quick (+ Designer)

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 625 Views 1 Watching
  • 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
    alexander.merkel
    wrote on last edited by
    #1

    Hello,
    I am planning to write a set of custom components in a way that other people can use the QtCreator Design mode to create a Gui. I intend to create these components in different styles that can be switched from within the Design mode by inserting the name of a Style in some property field.(This is the most usable way I could come up with.)

    I cannot find a proper solution for this problem, all my approaches have some sort of flaw.

    1. Putting all the styles in contextProperties:

    -prohibits a style change in Design mode since contextProperty values cannot be accessed. All you get in Design mode is #contextPropertyName# if i am not mistaken.

    1. Creating a global javascript File (.pragma) that has all style values in variables and includes a function that takes a Stylename parameter that changes these variables to the correct values:
    • if a property is assigned a javascript variable a change of this variable will not trigger a "property changed event" as a change of this property from within qml would. Since all components have several style dependent properties. triggering these changes by hand seems excessive work to me.
      IS THERE A REPAINT ALL that could do that???

    • i also had trouble getting the function to change the variable values in Design mode

    1. I have a (kind of) working solution involving QtObjects holding style properties and a loader dynamically changing its source. But that would involve loading the Style Objects into every Component which might be bad for performance.

    Thanks

    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