Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Can I create custom stylesheet pseudo-states?

    General and Desktop
    qt5 stylesheet sub-controls pseudo-states
    3
    5
    3080
    Loading More Posts
    • 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
      Jakob last edited by

      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 Reply Quote 0
      • D
        Devopia53 @Jakob last edited by

        @Jakob

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

        J 1 Reply Last reply Reply Quote 0
        • J
          Jakob @Devopia53 last edited by

          @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 Reply Quote 0
          • raven-worx
            raven-worx Moderators last edited by

            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 Reply Quote 1
            • J
              Jakob @raven-worx last edited by

              @raven-worx Oke, thanx for the clear answer

              1 Reply Last reply Reply Quote 0
              • First post
                Last post