本文整理汇总了C++中QMenu::setStatusTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenu::setStatusTip方法的具体用法?C++ QMenu::setStatusTip怎么用?C++ QMenu::setStatusTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenu
的用法示例。
在下文中一共展示了QMenu::setStatusTip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
/** GUI setup
*/
spqrMainWindow::spqrMainWindow(int argc, char *argv[], QWidget *parent)
: QMainWindow(parent), MruHelper("spqr")
{
statusBar()->showMessage(tr("spqr Setup"));
lqPreferences p;
p.loadGeometry(this);
con = new ConsoleEdit(argc, argv);
connect(con, SIGNAL(engine_ready()), this, SLOT(engineReady()));
make_tabs();
QMenu *m = menuBar()->addMenu(tr("&File"));
m->setStatusTip(tr("Show File operations"));
m->addAction(tr("&New..."), this, SLOT(newFile()), QKeySequence::New)->setStatusTip(tr("Create a new file"));
m->addAction(tr("&Open..."), this, SLOT(openFile()), QKeySequence::Open)->setStatusTip(tr("Open an existing file"));
m->addMenu(mruMenu = new QMenu(tr("Recent &Files...")))->setStatusTip(tr("List recently opened files"));
loadMru(p, this);
m->addSeparator();
m->addAction(tr("&Save"), this, SLOT(saveFile()), QKeySequence::Save)->setStatusTip(tr("Save the document to disk"));
m->addAction(tr("Save &As..."), this, SLOT(saveFileAs()), QKeySequence::SaveAs)->setStatusTip(tr("Save the document under a new name"));
m->addSeparator();
m->addAction(tr("&Quit"), qApp, SLOT(quit()), QKeySequence::Quit)->setStatusTip(tr("Exit the application"));
// detach the background processor to avoid a random GPF exiting the program
connect(qApp, &QApplication::aboutToQuit, []() { SwiPrologEngine::quit_request(); });
menuBar()->addSeparator();
menuBar()->addAction("&Exec", this, SLOT(execSource()))->setStatusTip(tr("Run Prolog Source code"));
menuBar()->addAction("&Source", this, SLOT(viewSource()))->setStatusTip(tr("Show the Prolog source window"));
menuBar()->addAction("&Console", this, SLOT(viewConsole()))->setStatusTip(tr("Show the SWI-Prolog console"));
menuBar()->addAction("&Help", this, SLOT(viewHelp()))->setStatusTip(tr("Show SWI-Prolog helpDoc"));
lastDir = p.value("lastDir").toString();
QString currFile = p.value("fileSource").toString();
if (argc >= 2)
currFile = argv[1];
if (currFile.length())
openSourceFile(currFile);
}
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
lineEdit(new QLineEdit)
{
QWidget *widget = new QWidget(); /* TO DO */
/* Add layouts, buttuns, etc to widget */
setCentralWidget(widget);
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
QAction *openAct = new QAction(tr("&Open"), this);
openAct->setShortcuts(QKeySequence::Open);
openAct->setStatusTip(tr("Open File"));
fileMenu->addAction(openAct);
fileMenu->setStatusTip(tr("File")); /* it doesn'twork :( */
connect(openAct, SIGNAL(triggered()), this, SLOT(openFile()));
lineEdit->setReadOnly(true);
statusBar()->addWidget(lineEdit);
statusBar()->setToolTip("");
}
示例3: displayData
QMenu *BtMenuView::newMenu(QMenu *parentMenu, const QModelIndex &itemIndex) {
QVariant displayData(m_model->data(itemIndex, Qt::DisplayRole));
QVariant iconData(m_model->data(itemIndex, Qt::DecorationRole));
QVariant toolTipData(m_model->data(itemIndex, Qt::ToolTipRole));
QVariant statusTipData(m_model->data(itemIndex, Qt::StatusTipRole));
QVariant whatsThisData(m_model->data(itemIndex, Qt::WhatsThisRole));
QMenu *childMenu = new QMenu(parentMenu);
// Set text:
if (displayData.canConvert(QVariant::String)) {
childMenu->setTitle(displayData.toString());
}
// Set icon:
if (iconData.canConvert(QVariant::Icon)) {
childMenu->setIcon(iconData.value<QIcon>());
}
// Set tooltip:
if (toolTipData.canConvert(QVariant::String)) {
childMenu->setToolTip(toolTipData.toString());
}
// Set status tip:
if (statusTipData.canConvert(QVariant::String)) {
childMenu->setStatusTip(statusTipData.toString());
}
// Set whatsthis:
if (whatsThisData.canConvert(QVariant::String)) {
childMenu->setWhatsThis(whatsThisData.toString());
}
return childMenu;
}