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. how do you use QML to changing skins(themes)
Qt 6.11 is out! See what's new in the release blog

how do you use QML to changing skins(themes)

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 1.8k 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.
  • TongT Offline
    TongT Offline
    Tong
    wrote on last edited by
    #1

    Hello, everyone!
    I want to use QML for skin change,widgets + qss are easy to implement,but I'm not sure what to do with QML. who can tell me how to do it, thanks

    1 Reply Last reply
    0
    • 7 Offline
      7 Offline
      77Percent
      wrote on last edited by
      #2

      Hello! AFAIK, you can create global variables for each element value of your 'appskin' you want to change (width, height, background color/image, etc) for each element ( like button, listview, etc.). The next step is to set values of your elements as they are set in 'global variables', eg:
      Button {
      id: awesomeButton;
      width: yourVarForAwesomeButtonWidth;
      }
      , or something like that. And, the last step is to create a method, which changes global variables, eg load values from 'application skin file' or smth like that. And when you want to change app skin you just call this method with skin name/skinFilePath as a param. And, ofc, don't forget to check values from external skin file for validity. That's all. Hope in helps.

      1 Reply Last reply
      1
      • X Offline
        X Offline
        X-Krys
        wrote on last edited by
        #3

        Hi,

        Maybe you can try the CSS approach implemented here : https://github.com/Ableton/aqt-stylesheets

        See video here : https://www.youtube.com/watch?v=O5GJCyBOuCY

        1 Reply Last reply
        3

        • Login

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