QToolButton: weird padding behavior compared to QPushButton
-
Can someone explain why QToolButton's padding mechanics are so different and counter-intuitive to QPushButton's?
Here's a QToolButton and QPushButton without any padding:
Now I add left padding of 50px to both buttons. QPushButton behaves as expected, QToolButton sets its padding on the right side - wtf
Ok, lets try it with top-padding, maybe this direction isn't that messed up. 20px top padding:
WTF??
Why is that? -
Hi,
Can you show a minimal sample code that reproduces this ?
What OS and Qt Version are you using ?
-
I didn't write any code. I made this in QtDesigner, set the padding with style sheets and opened the widget preview.
OS is Windows 10, Qt Version is 5.3.1 but I can also reproduce it under Qt 5.5
-
@Justin-Sayne
Hi
I dont think QToolButton support padding as its not listed in the list of widgets that does. -
Well, if on the same site you seach for QToolButton in the list of styleable widgets, it says it supports the box model. And you can even reach an example from there where they added right padding to a QToolButton.
It would also be really counter-intuitive if a QToolButton didn't support padding at all but QPushButton does. -
@Justin-Sayne
I agree it seems odd as ToolButton is also AbstractButton.
Testet with Qt5.7 and it really seems to ignore padding.
{ margin: 22px } Does work.
So it seems it support box-model but not the padding part ;)So I would have a look in
https://bugreports.qt.io/browse/QTBUG-14745?jql=text ~ "qtoolbutton"too see if reported as bug.