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?
Forum Updated to NodeBB v4.3 + New Features

Can I create custom stylesheet pseudo-states?

Scheduled Pinned Locked Moved Solved General and Desktop
qt5stylesheetsub-controlspseudo-states
5 Posts 3 Posters 4.1k 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.
  • J Offline
    J Offline
    Jakob
    wrote on 19 Jan 2016, 07:51 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 19 Jan 2016, 08:38
    0
    • J Jakob
      19 Jan 2016, 07:51

      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 19 Jan 2016, 08:38 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 19 Jan 2016, 08:42
      0
      • D Devopia53
        19 Jan 2016, 08:38

        @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 19 Jan 2016, 08:42 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
        • R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 19 Jan 2016, 08:46 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 19 Jan 2016, 08:48
          1
          • R raven-worx
            19 Jan 2016, 08:46

            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 19 Jan 2016, 08:48 last edited by
            #5

            @raven-worx Oke, thanx for the clear answer

            1 Reply Last reply
            0

            1/5

            19 Jan 2016, 07:51

            • Login

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