forked from qt-creator/qt-creator
Utils: Add a ProxyAction factory which overrides an action icon
There are several places where we want to override an icon when adding an action to a toolbar and to a menu, because we need to different icon variations. Change-Id: I0bed4d002b8f83c9ce3278137aa463c20d1dc7be Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -175,3 +175,12 @@ QString ProxyAction::stringWithAppendedShortcut(const QString &str, const QKeySe
|
||||
return QString::fromLatin1("%1 <span style=\"color: gray; font-size: small\">%2</span>").
|
||||
arg(s, shortcut.toString(QKeySequence::NativeText));
|
||||
}
|
||||
|
||||
ProxyAction *ProxyAction::proxyActionWithIcon(QAction *original, const QIcon &newIcon)
|
||||
{
|
||||
ProxyAction *proxyAction = new ProxyAction(original);
|
||||
proxyAction->setAction(original);
|
||||
proxyAction->setIcon(newIcon);
|
||||
proxyAction->setAttribute(UpdateText);
|
||||
return proxyAction;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user