summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qtoolbutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qtoolbutton.cpp')
-rw-r--r--src/gui/widgets/qtoolbutton.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/widgets/qtoolbutton.cpp b/src/gui/widgets/qtoolbutton.cpp
index 5d0a98a..3901245 100644
--- a/src/gui/widgets/qtoolbutton.cpp
+++ b/src/gui/widgets/qtoolbutton.cpp
@@ -378,11 +378,17 @@ void QToolButton::initStyleOption(QStyleOptionToolButton *option) const
if (d->hasMenu())
option->features |= QStyleOptionToolButton::HasMenu;
#endif
- if (d->toolButtonStyle == Qt::ToolButtonSystemDefault) {
+ if (d->toolButtonStyle == Qt::ToolButtonFollowStyle) {
option->toolButtonStyle = Qt::ToolButtonStyle(style()->styleHint(QStyle::SH_ToolButtonStyle, option, this));
} else
option->toolButtonStyle = d->toolButtonStyle;
+ if (option->toolButtonStyle == Qt::ToolButtonTextBesideIcon) {
+ // If the action is not prioritized, remove the text label to save space
+ if (d->defaultAction && d->defaultAction->priority() < QAction::NormalPriority)
+ option->toolButtonStyle = Qt::ToolButtonIconOnly;
+ }
+
if (d->icon.isNull() && d->arrowType == Qt::NoArrow && !forceNoText) {
if (!d->text.isEmpty())
option->toolButtonStyle = Qt::ToolButtonTextOnly;
@@ -482,7 +488,7 @@ QSize QToolButton::minimumSizeHint() const
If you want your toolbars to depend on system settings,
as is possible in GNOME and KDE desktop environments you should
- use the ToolButtonSystemDefault.
+ use the ToolButtonFollowStyle.
QToolButton automatically connects this slot to the relevant
signal in the QMainWindow in which is resides.