PDA

View Full Version : Left aligning QToolButtons in a QToolBar



neFAST
15th September 2015, 22:53
Hi everyone,
I have seen many old topics with that question but no answer.
I'm still working with Qt4 and I've tried with stylesheet but did not find a way to left align my QToolButton icon and text. They are always shown centered.
Anyone has a tip?

Thanks in advance

d_stranz
17th September 2015, 17:49
Seems odd, but there is apparently no way to do this without a lot of difficulty. All of the painting methods for QToolButton (in Qt 5.5 at least) use monolithic drawing methods (e.g. drawComplexControl()), so even if you derived from QToolButton and overrode the paintEvent(), you'd still have to pretty much draw it by hand.

neFAST
21st September 2015, 22:07
Thanks for looking at this.
I was digging in drawComplexControl() too but I could not find where the rect/position of the QToolButton is defined.