saveStateAction->setToolTip(tr("Saves the state history.")); // No tool tip ever shows up.
connect(saveStateAction, SIGNAL(triggered()), this, SLOT(saveStateHistory()));
loadStateAction->setToolTip(tr("Loads the state history."));
connect(loadStateAction, SIGNAL(triggered()), this, SLOT(loadStateHistory()));
recordAction->setCheckable(true); // Checkable makes no difference.
recordAction->setToolTip(tr("Toggles recording."));
connect(recordAction, SIGNAL(triggered()), this, SLOT(record()));
QMenu* fileMenu
= menuBar
->addMenu
(tr
("&File"));
fileMenu->addAction(saveStateAction); // Inside a QMenu checkable works, but no tool tip.
fileMenu->addAction(loadStateAction);
menuBar->addSeparator(); // The separator doesn't do anything either...
menuBar->addAction(" "); // ...so I hacked this for now. Would love to disable this button, but can't.
menuBar->addAction(recordAction); // The actions added to the menu directly are not checkable and no tool tip shows up.
QAction* saveStateAction = new QAction(tr("&Save State"), this);
saveStateAction->setToolTip(tr("Saves the state history.")); // No tool tip ever shows up.
saveStateAction->setShortcut(QKeySequence(tr("Ctrl+S")));
connect(saveStateAction, SIGNAL(triggered()), this, SLOT(saveStateHistory()));
QAction* loadStateAction = new QAction(tr("&Load State"), this);
loadStateAction->setToolTip(tr("Loads the state history."));
loadStateAction->setShortcut(QKeySequence(tr("Ctrl+L")));
connect(loadStateAction, SIGNAL(triggered()), this, SLOT(loadStateHistory()));
QAction* recordAction = new QAction(tr("Record"), this);
recordAction->setCheckable(true); // Checkable makes no difference.
recordAction->setToolTip(tr("Toggles recording."));
recordAction->setShortcut(QKeySequence(tr("Return")));
connect(recordAction, SIGNAL(triggered()), this, SLOT(record()));
QMenuBar* menuBar = new QMenuBar();
QMenu* fileMenu = menuBar->addMenu(tr("&File"));
fileMenu->addAction(saveStateAction); // Inside a QMenu checkable works, but no tool tip.
fileMenu->addAction(loadStateAction);
menuBar->addSeparator(); // The separator doesn't do anything either...
menuBar->addAction(" "); // ...so I hacked this for now. Would love to disable this button, but can't.
menuBar->addAction(recordAction); // The actions added to the menu directly are not checkable and no tool tip shows up.
To copy to clipboard, switch view to plain text mode
Bookmarks