diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-07-17 11:36:08 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-07-17 13:24:22 (GMT) |
commit | 5f6c0594f07df57af2574be0420a68f84b703b87 (patch) | |
tree | 77fadf5fe3fb6de31224cc0c351005eec0750398 /tests/auto/qtoolbutton | |
parent | 080231536cbc5e9acc486e57e165320416f66d85 (diff) | |
download | Qt-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 'tests/auto/qtoolbutton')
-rw-r--r-- | tests/auto/qtoolbutton/tst_qtoolbutton.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp index 9e342ad..4176507 100644 --- a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp @@ -64,6 +64,7 @@ public: private slots: void getSetCheck(); void triggered(); + void collapseTextOnPriority(); void task230994_iconSize(); void task176137_autoRepeatOfAction(); @@ -160,6 +161,32 @@ void tst_QToolButton::triggered() delete menu; } +void tst_QToolButton::collapseTextOnPriority() +{ + class MyToolButton : public QToolButton + { + friend class tst_QToolButton; + public: + void initStyleOption(QStyleOptionToolButton *option) + { + QToolButton::initStyleOption(option); + } + }; + + MyToolButton button; + button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + QAction action(button.style()->standardIcon(QStyle::SP_ArrowBack), "test", 0); + button.setDefaultAction(&action); + + QStyleOptionToolButton option; + button.initStyleOption(&option); + QVERIFY(option.toolButtonStyle == Qt::ToolButtonTextBesideIcon); + action.setPriority(QAction::LowPriority); + button.initStyleOption(&option); + QVERIFY(option.toolButtonStyle == Qt::ToolButtonIconOnly); +} + + void tst_QToolButton::task230994_iconSize() { //we check that the iconsize returned bu initStyleOption is valid |