本文整理汇总了C++中CAction::addTo方法的典型用法代码示例。如果您正苦于以下问题:C++ CAction::addTo方法的具体用法?C++ CAction::addTo怎么用?C++ CAction::addTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAction
的用法示例。
在下文中一共展示了CAction::addTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void HelloWorldPlugin::init()
{
if (pluginWindow())
{
messagePanel();
pluginWindow()->statusBar();
pluginWindow()->menuBar();
CAction * fileCloseAction = new CAction(tr("Close"), icon(), tr("&Close"),
Qt::CTRL + Qt::Key_C, pluginWindow(), "fileCloseAction");
fileCloseAction->setParentMenuText(tr("File"));
connect(fileCloseAction, SIGNAL(activated()), pluginWindow(), SLOT(close()));
QPopupMenu * fileMenu = new QPopupMenu(pluginWindow(), "fileMenu");
pluginWindow()->menuBar()->insertItem(tr("&File"), fileMenu);
fileCloseAction->addTo(fileMenu);
enableHotKeyEditor();
message(icon(), "Creating Hello World Plugin");
}
}
示例2: CHotKeyEditorMenu
//.........这里部分代码省略.........
fileRefreshAction = new CAction (tr("Refresh"), getPixmapIcon("refreshIcon"),
tr("&Refresh"), Qt::Key_F5, this, "fileRefreshAction");
fileRefreshAction->setParentMenuText(tr("File"));
connect(fileRefreshAction, SIGNAL(activated()), this, SLOT(refresh()));
actionKillProcessAction = new CAction (tr("Kill Process"), getPixmapIcon("killProcessIcon"),
tr("&Kill Process"), Qt::CTRL + Qt::Key_K, this, "actionKillProcessAction");
actionKillProcessAction->setParentMenuText(tr("Action"));
connect(actionKillProcessAction, SIGNAL(activated()), this, SLOT(killProcesses()));
CAction * actionPingAction = new CAction (tr("Ping"), getPixmapIcon("pingIcon"),
tr("&Ping"), Qt::CTRL + Qt::Key_P, this, "actionPingAction");
actionPingAction->setParentMenuText(tr("Action"));
connect(actionPingAction, SIGNAL(activated()), this, SLOT(ping()));
CAction * actionShutdownAction = new CAction (tr("Shutdown"), getPixmapIcon("serverShutdownIcon"),
tr("&Shutdown"), 0, this, "actionShutdownAction");
actionShutdownAction->setParentMenuText(tr("Action"));
connect(actionShutdownAction, SIGNAL(activated()), this, SLOT(shutdown()));
fileTimerAction = new CAction (tr("Start Refresh Timer"), getPixmapIcon("timerIcon"),
tr("Start Refresh &Timer"), Qt::CTRL + Qt::Key_T, this, "fileTimerAction", true);
fileTimerAction->setParentMenuText(tr("File"));
connect(fileTimerAction, SIGNAL(toggled(bool)), this, SLOT(fileTimerActionToggled(bool)));
QPopupMenu *fileMenu = new QPopupMenu(this);
QPopupMenu *actionMenu = new QPopupMenu(this);
QPopupMenu *viewMenu = new QPopupMenu(this);
connect(viewMenu, SIGNAL(aboutToShow()), this, SLOT(viewMenuAboutToShow()));
fileMenu->insertItem(getPixmapIcon("saveIcon"), tr("Save"), save_menu);
fileMenu->insertSeparator();
fileRefreshAction->addTo(fileMenu);
fileMenu->insertSeparator();
fileTimerAction->addTo(fileMenu);
fileMenu->insertSeparator();
fileCloseAction->addTo(fileMenu);
menuBar()->insertItem(tr("&File"), fileMenu);
viewShowMessagesAction->addTo(viewMenu);
menuBar()->insertItem(tr("&View"), viewMenu);
actionKillProcessAction->addTo(actionMenu);
flush_menu = flushMenu(m_mysql->mysql());
connect(flush_menu, SIGNAL(activated(int)), this, SLOT(flush(int)));
actionMenu->insertItem(getPixmapIcon("flushIcon"),tr("Flush"), flush_menu);
actionPingAction->addTo(actionMenu);
actionMenu->insertSeparator();
actionShutdownAction->addTo(actionMenu);
menuBar()->insertItem(tr("&Action"), actionMenu);
new CHotKeyEditorMenu(this, menuBar(), "HotKeyEditor");
QToolBar * actionToolBar = new QToolBar(tr("Action Bar"), this, Top);
QToolButton * saveTypeButton = new QToolButton(actionToolBar);
saveTypeButton->setPopup(save_menu);
saveTypeButton->setPixmap(getPixmapIcon("saveIcon"));
saveTypeButton->setTextLabel(tr("Save"), true);
saveTypeButton->setPopupDelay(0);
actionToolBar->addSeparator();