Show keyboard shortcut in tooltips automatically
-
Howdy,
Suppose I have a QAction set like that:
@QAction *undo = new QAction( QString::fromAscii( "Undo" ), parent );
undo->setToolTip( QString::fromAscii( "Undo" ) );
undo->setShortcut( QKeySequence( "Ctrl+Z" ) );
@Is there any automatic way to make the tool tip for that action appears as Undo (Ctrl+Z)?
Thanks in advance,
H. -
I don't know if there is a built-in Qt way. I do it this way:
@
static const QString UndoShortcut(QStringLiteral("Ctrl+Z"));
static const QString UndoTooltip(QString("Undo - %1").arg(ModeShortcut));
...actionUndo->setShortcut(QKeySequence(UndoShortcut));
actionUndo->setToolTip(UndoTooltip);
@