Stylesheet changes size of widget in a layout

  • 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.

  • Lifetime Qt Champion


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

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

  • 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.

  • 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

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.