diff options
author | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-07-22 13:14:29 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-07-23 09:40:54 +0000 |
commit | a09b41bc9fc2bc6c837057f303fd82b19c6f5413 (patch) | |
tree | 0a677776ea65e068f6dcfd8cd3352937cc69bf30 /src/plugins/platforms/windows | |
parent | bfe4bca4986c033347d880e9bd3375f81093172b (diff) |
Fix action shortcuts for QToolButton
Reverting change 4db5d3ccd17d448b59db491e2f261892f31fec74, since it
introduced two separate regressions:
1. QToolButton would prefer text() over iconText()
2. Actions with a mnemonic would create a shortcut when added to
a tool button.
There is a fundamental problem here, which is impossible to solve
correctly: A menu item with the text "Short&cut" will create a mnemonic,
i.e. it will be triggered by pressing 'c' when the menu is open. However,
a button with the text "Short&cut" will create a shortcut that is triggered
by Alt+C as long as the window has focus. Also, iconText() is used for tool
tips, so it should not contain shortcut related '&'s.
This patch attempts to find a sensible compromise:
1. If the text is set through QAction::setText(), QToolButton will not
create a shortcut, and will not display an underline.
2. Using QAction::setIconText("Short&cut") will create the shortcut.
3. Tooltips will not show any extra '&'s when generated from
text(), but when using setIconText() directly, any '&' characters used
to create shortcuts will also be visible in the tooltip.
Task-number: QTBUG-23396
Task-number: QTBUG-47306
Change-Id: Ieea2fc569807c862ca462349bf91922a4029700f
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows')
0 files changed, 0 insertions, 0 deletions