I have a QLabel and a QPushButton added to a QHBoxLayout. The QLabel has its margins set to 0 and the layout has margin and content margins set to 0. The label and button have the same background color and the button has border set to none. However, the button still looks with a brighter color than the label and there is some extra space around the button, so it doesn't look like it's "glued" to the label. I want them to look like one big widget.
-
If this problem is reproducible on Windows with Aero theme, please try to switch to Classic theme and let us know what do you see.Ilya– Ilya2015-08-12 10:48:36 +00:00Commented Aug 12, 2015 at 10:48
-
I am on Debian Jessieulak blade– ulak blade2015-08-12 11:16:52 +00:00Commented Aug 12, 2015 at 11:16
-
@Ilya there seems to be slight space between the label and the button, but I don't know why, I've set anything related to margin on both widgets and the layout to 0ulak blade– ulak blade2015-08-12 11:18:20 +00:00Commented Aug 12, 2015 at 11:18
-
Ok, thank you for this additional info. Could you add screenshot and your code which creates all these widgets? What is your Qt version?Ilya– Ilya2015-08-12 11:52:34 +00:00Commented Aug 12, 2015 at 11:52
Add a comment
|
2 Answers
In Qt, margins describe the space surrounding the layout. In newer versions of Qt, the margins on the top/bottom/left/right can be set individually through setContentsMargins().
The space between widgets in the same layout is described by the spacing property. The spacing has nothing to do with the margins. Try calling hboxLayout->setSpacing(0); This should work.
1 Comment
IceFire
All set and still, there is margin. styleSheet-margin destroys the layout