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. Stylesheet changes size of widget in a layout
Forum Updated to NodeBB v4.3 + New Features

Stylesheet changes size of widget in a layout

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 1.7k 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.
  • K Offline
    K Offline
    krisjobs
    wrote on last edited by
    #1

    Greeting everyone,

    It's been a couple of hourse since i've began searching for an answer to this question, but so far no luck.

    The problem is basically as follows:

    I have a QGridLayout with 4 symmetrically arranged rectangle DockWidgets (which always have a fixed place in a separate container widget). So I'm trying to change the background color of the titlebar on focus change, the problem is, when I do so, the height of the affected widget gets bigger, and they are no longer symmetrical.

    I'm changing the titlebar color via @dock->setStyleSheet("QDockWidget::title {background: red;}");@

    I'm using the latest version of qt and qt creator as I've just installed it today on a new computer, so I guess it has nothing to do with this bug.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      IIRC when using style sheet, a dedicated style is used to draw the widget which might lead to subtile differences when drawing that widget.

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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ray4qt
        wrote on last edited by
        #3

        Does it help if you set a border property, perhaps to none?

        1 Reply Last reply
        0
        • JeroentjehomeJ Offline
          JeroentjehomeJ Offline
          Jeroentjehome
          wrote on last edited by
          #4

          When setting the stylesheet you overwrite the inherited stylesheet of the widgets parent. So, there might be a small difference created between your parent and child widget.

          Greetz, Jeroen

          1 Reply Last reply
          0
          • K Offline
            K Offline
            krisjobs
            wrote on last edited by
            #5

            First of all thank you all for the replies.

            [quote author="ray4qt" date="1406852874"]Does it help if you set a border property, perhaps to none?[/quote]

            Unfortunately this doesn't help.

            So are there any other suggestions? Or workarounds? I'd really like to see it working :(

            Thank you in advance

            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