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. Can I create custom stylesheet pseudo-states?

Can I create custom stylesheet pseudo-states?

Scheduled Pinned Locked Moved Solved General and Desktop
qt5stylesheetsub-controlspseudo-states
5 Posts 3 Posters 4.0k 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.
  • J Offline
    J Offline
    Jakob
    wrote on last edited by
    #1

    In our application we have centralized the styling. Now I want to create a custom control, which will have some Q_PROPERTYs and I would like to set a different styling for that control in the global stylesheet based on the value of some of these properties.

    What comes to mind then, is to create custom pseudo-states for such properties and use these in the stylesheet. In particular I want to set colors and fonts in these pseudo-states. Does Qt5 support this?

    D 1 Reply Last reply
    0
    • J Jakob

      In our application we have centralized the styling. Now I want to create a custom control, which will have some Q_PROPERTYs and I would like to set a different styling for that control in the global stylesheet based on the value of some of these properties.

      What comes to mind then, is to create custom pseudo-states for such properties and use these in the stylesheet. In particular I want to set colors and fonts in these pseudo-states. Does Qt5 support this?

      D Offline
      D Offline
      Devopia53
      wrote on last edited by
      #2

      @Jakob

      You can read http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-using-dynamic-properties will help.

      J 1 Reply Last reply
      0
      • D Devopia53

        @Jakob

        You can read http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-using-dynamic-properties will help.

        J Offline
        J Offline
        Jakob
        wrote on last edited by
        #3

        @Devopia53 Thanx for the hint - I'm actually very aware of that mechanism, and we are already using it a lot. It serves a slightly different use case however. It could be used, but creating custom pseudo-states seems to fit better in the big picture within the application.

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          no this is not supported at all, unfortunately.
          The only way is to set properties etc. and repolish the widget.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          J 1 Reply Last reply
          1
          • raven-worxR raven-worx

            no this is not supported at all, unfortunately.
            The only way is to set properties etc. and repolish the widget.

            J Offline
            J Offline
            Jakob
            wrote on last edited by
            #5

            @raven-worx Oke, thanx for the clear answer

            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