summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qaction.cpp
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-07-17 11:36:08 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2009-07-17 13:24:22 (GMT)
commit5f6c0594f07df57af2574be0420a68f84b703b87 (patch)
tree77fadf5fe3fb6de31224cc0c351005eec0750398 /src/gui/kernel/qaction.cpp
parent080231536cbc5e9acc486e57e165320416f66d85 (diff)
downloadQt-5f6c0594f07df57af2574be0420a68f84b703b87.zip
Qt-5f6c0594f07df57af2574be0420a68f84b703b87.tar.gz
Qt-5f6c0594f07df57af2574be0420a68f84b703b87.tar.bz2
Add priority property to QAction
We need this to support the behavior in Gtk+ where, when Qt::ToolButtonTextBesideIcon is used, only text labels for important actions are shown. It will also enable us to prioritize actions in the future when for instance collapsing a toolbar. Task-number: 258290 Reviewed-by: thierry
Diffstat (limited to 'src/gui/kernel/qaction.cpp')
-rw-r--r--src/gui/kernel/qaction.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index 4ee17f4..09ba6cc 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -81,7 +81,7 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
- menuRole(QAction::TextHeuristicRole), iconVisibleInMenu(-1)
+ menuRole(QAction::TextHeuristicRole), priority(QAction::NormalPriority), iconVisibleInMenu(-1)
{
#ifdef QT3_SUPPORT
static int qt_static_action_id = -1;
@@ -909,6 +909,31 @@ QString QAction::whatsThis() const
return d->whatsthis;
}
+/*!
+ \property QAction::priority
+ \since 4.6
+
+ \brief tells collapsible layouts how the action should be prioritized
+
+ This property can be set to indicate that an action should be prioritied
+ in a layout. For instance when toolbars have the Qt::ToolButtonTextBesideIcon
+ mode is set, lower priority actions will hide text labels to preserve space.
+*/
+void QAction::setPriority(Priority priority)
+{
+ Q_D(QAction);
+ if (d->priority == priority)
+ return;
+
+ d->priority = priority;
+ d->sendDataChanged();
+}
+
+QAction::Priority QAction::priority() const
+{
+ Q_D(const QAction);
+ return d->priority;
+}
/*!
\property QAction::checkable