You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand where in the code I should try to rewrite the spacing/sizing definition in order to get a more natural spaces.
With current code, this is what we get:
auto tb0 = new QToolButton;
tb0->setText("Just text");
auto tb1 = new QToolButton;
tb1->setText("Just text");
tb1->setIcon(w->style()->standardIcon(QStyle::SP_DesktopIcon));
tb1->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
It looks like the total extra spacing is calculated correctly (the button's width could be ok) but the distribution between the 3 spacing (left, middle, right) is wrong.
Looking at forks, I was hoping @vladimir-kraus or @jcelerier could show me the way :)
Then QCommonStyle::drawComplexControl() will call proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget) which is not handled by PhantomStyle, so it will default to QCommonStyle::drawControl(element, option, painter, widget)
I'm trying to understand where in the code I should try to rewrite the spacing/sizing definition in order to get a more natural spaces.
With current code, this is what we get:
It looks like the total extra spacing is calculated correctly (the button's width could be ok) but the distribution between the 3 spacing (left, middle, right) is wrong.
Looking at forks, I was hoping @vladimir-kraus or @jcelerier could show me the way :)
As far as I know, it starts here:
phantomstyle/src/phantom/phantomstyle.cpp
Lines 4029 to 4034 in 309c97a
Then
QCommonStyle::drawComplexControl()
will callproxy()->drawControl(CE_ToolButtonLabel, &label, p, widget)
which is not handled by PhantomStyle, so it will default toQCommonStyle::drawControl(element, option, painter, widget)
The icon is drawn here (note the comment)
https://github.com/qt/qtbase/blob/6652bf2353d807f724f398a15cb22c188830f57c/src/widgets/styles/qcommonstyle.cpp#L1729-L1733
PhantomStyle::drawItemPixmap()
will callQCommonStyle::drawItemPixmap()
Then the text is drawn here
https://github.com/qt/qtbase/blob/6652bf2353d807f724f398a15cb22c188830f57c/src/widgets/styles/qcommonstyle.cpp#L1739-L1743
Which will be handled by
PhantomStyle::drawItemText()
The text was updated successfully, but these errors were encountered: