Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Detect arbitrary custom attributes from application QSS style in MyWidget::paintEvent?
Forum Updated to NodeBB v4.3 + New Features

Detect arbitrary custom attributes from application QSS style in MyWidget::paintEvent?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 817 Views 2 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on 28 May 2016, 20:41 last edited by
    #1

    So I have a custom widget that I want to style. I use an application-wide style for styling everything else, but my widget has this specific thing that it paints, and it would be very neat if it could retrieve its color from QSS, e. g.:

    MyWidget { customThingColor: red }
    

    Is it doable? Certainly, it's not the only way to pass a parameter to a widget, but it would be most neat if I could put ALL the styling code in a single app-wide QSS string.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 28 May 2016, 22:12 last edited by
      #2

      Hi,

      You can use designable Q_PROPERTIES for that. See here

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      V 1 Reply Last reply 29 May 2016, 12:50
      1
      • S SGaist
        28 May 2016, 22:12

        Hi,

        You can use designable Q_PROPERTIES for that. See here

        V Offline
        V Offline
        Violet Giraffe
        wrote on 29 May 2016, 12:50 last edited by
        #3

        @SGaist, awesome, that works! Thanks a lot. Sorry I couldn't find it in the docs.

        1 Reply Last reply
        0

        1/3

        28 May 2016, 20:41

        • Login

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