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. Stylesheets control Layout objects?
QtWS25 Last Chance

Stylesheets control Layout objects?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 13.7k 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.
  • B Offline
    B Offline
    bovilexic
    wrote on 22 Nov 2011, 00:06 last edited by
    #1

    Greetings -

    Is it possible to have a stylesheet control parameters of a QLayout object in the same way it does for QWidgets? For example, if I have this:

    @
    QVBoxLayout {
    margin-top: 0px;
    margin-bottom: 0px;
    margin-left: 2px;
    margin-right: 2px;
    }
    @

    there is no change in the appearance of my application. Do stylesheets simply not work with QLayout objects, or am I just using incorrect syntax?

    Thanks!

    EDIT: please put code (also qss) inside @-tags or use the code button in the editor, Gerolf

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on 22 Nov 2011, 06:44 last edited by
      #2

      I don't think it is possible to apply stylesheets to layout items. There are some properties which are dervied from the style sheet that is applied to the parent widget (spacing), but contentMargins is unfortunately not one of them (directly taken from the currently style).

      However, I think it would be quite useful to have such a feature (for example by adding a stylesheet only contentMargins property to QWidget which is inherited by layouts as we have for spacing). So feel free to add a "suggestion":https://bugreports.qt.nokia.com/, +1 from me.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bovilexic
        wrote on 22 Nov 2011, 16:49 last edited by
        #3

        Thanks! This is it:

        https://bugreports.qt.nokia.com/browse/QTBUG-22862
        

        [quote author="Lukas Geyer" date="1321944258"]I don't think it is possible to apply stylesheets to layout items. There are some properties which are dervied from the style sheet that is applied to the parent widget (spacing), but contentMargins is unfortunately not one of them (directly taken from the currently style).

        However, I think it would be quite useful to have such a feature (for example by adding a stylesheet only contentMargins property to QWidget which is inherited by layouts as we have for spacing). So feel free to add a "suggestion":https://bugreports.qt.nokia.com/, +1 from me.[/quote]

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on 22 Nov 2011, 19:17 last edited by
          #4

          ... +1

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JonB
            wrote on 22 Dec 2017, 15:23 last edited by
            #5

            This was in 2011, and I need it now!!
            Any progress? :)

            M 1 Reply Last reply 22 Dec 2017, 17:31
            0
            • J JonB
              22 Dec 2017, 15:23

              This was in 2011, and I need it now!!
              Any progress? :)

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 22 Dec 2017, 17:31 last edited by
              #6

              @JonB
              Hi
              Nope. Sadly.
              https://bugreports.qt.io/browse/QTBUG-22862

              And as far as i know, Layouts are not really into stylesheets at all.

              https://forum.qt.io/topic/32043/qlayout-margin-through-stylesheet-solved/

              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