forked from qt-creator/qt-creator
Fix ProxyAction if layered 2 times
Change-Id: Icf17f93deb259bfed85e138311d39300d72ee4b5 Reviewed-on: http://codereview.qt.nokia.com/193 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -38,7 +38,8 @@ ProxyAction::ProxyAction(QObject *parent) :
|
|||||||
QAction(parent),
|
QAction(parent),
|
||||||
m_action(0),
|
m_action(0),
|
||||||
m_attributes(0),
|
m_attributes(0),
|
||||||
m_showShortcut(false)
|
m_showShortcut(false),
|
||||||
|
m_block(false)
|
||||||
{
|
{
|
||||||
connect(this, SIGNAL(changed()), this, SLOT(updateToolTipWithKeySequence()));
|
connect(this, SIGNAL(changed()), this, SLOT(updateToolTipWithKeySequence()));
|
||||||
updateState();
|
updateState();
|
||||||
@@ -161,15 +162,14 @@ void ProxyAction::setShortcutVisibleInToolTip(bool visible)
|
|||||||
|
|
||||||
void ProxyAction::updateToolTipWithKeySequence()
|
void ProxyAction::updateToolTipWithKeySequence()
|
||||||
{
|
{
|
||||||
static bool block = false;
|
if (m_block)
|
||||||
if (block)
|
|
||||||
return;
|
return;
|
||||||
block = true;
|
m_block = true;
|
||||||
if (!m_showShortcut || shortcut().isEmpty())
|
if (!m_showShortcut || shortcut().isEmpty())
|
||||||
setToolTip(m_toolTip);
|
setToolTip(m_toolTip);
|
||||||
else
|
else
|
||||||
setToolTip(stringWithAppendedShortcut(m_toolTip, shortcut()));
|
setToolTip(stringWithAppendedShortcut(m_toolTip, shortcut()));
|
||||||
block = false;
|
m_block = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProxyAction::stringWithAppendedShortcut(const QString &str, const QKeySequence &shortcut)
|
QString ProxyAction::stringWithAppendedShortcut(const QString &str, const QKeySequence &shortcut)
|
||||||
|
@@ -81,6 +81,7 @@ private:
|
|||||||
Attributes m_attributes;
|
Attributes m_attributes;
|
||||||
bool m_showShortcut;
|
bool m_showShortcut;
|
||||||
QString m_toolTip;
|
QString m_toolTip;
|
||||||
|
bool m_block;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
Reference in New Issue
Block a user