本文整理汇总了C++中ContextMenu::addAction方法的典型用法代码示例。如果您正苦于以下问题:C++ ContextMenu::addAction方法的具体用法?C++ ContextMenu::addAction怎么用?C++ ContextMenu::addAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContextMenu
的用法示例。
在下文中一共展示了ContextMenu::addAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: polishSessionExplorerContextMenu
void TimelineWidget::polishSessionExplorerContextMenu(Subject &subject, const std::string &signal, const boost::any &v)
{
SessionExplorer &ses = dynamic_cast<SessionExplorer&>(subject);
if(ses.getItemViewType() == SessionExplorer::ANIMATION_ITEMS)
{
ContextMenu *pMenu = boost::any_cast<ContextMenu*>(v);
VERIFYNRV(pMenu);
pMenu->addAction(mpNewAnimationAction, "TIMELINEWIDGET_NEW_ANIMATION_ACTION");
}
}
示例2: updateContextMenu
void SpectralLibraryMatchResults::updateContextMenu(Subject& subject, const std::string& signal,
const boost::any& value)
{
ContextMenu* pMenu = boost::any_cast<ContextMenu*>(value);
if (pMenu == NULL)
{
return;
}
// only add actions if there are some results
if (mpTabWidget->count() > 0)
{
bool isSessionItem(false);
if (dynamic_cast<SessionExplorer*>(&subject) != NULL)
{
std::vector<SessionItem*> items = pMenu->getSessionItems();
if (items.size() > 1) // make sure only one item selected
{
return;
}
DockWindow* pWindow = getDockWindow();
if (items.front() != pWindow) // make sure it's the results window
{
return;
}
isSessionItem = true;
}
QObject* pParent = pMenu->getActionParent();
// add separator
QAction* pSeparatorAction = new QAction(pParent);
pSeparatorAction->setSeparator(true);
pMenu->addAction(pSeparatorAction, SPECTRAL_LIBRARY_MATCH_RESULTS_SEPARATOR_ACTION);
QAction* pClearAction = new QAction("&Clear", pParent);
pClearAction->setAutoRepeat(false);
pClearAction->setStatusTip("Clears the results from the current page");
VERIFYNR(connect(pClearAction, SIGNAL(triggered()), this, SLOT(clearPage())));
pMenu->addAction(pClearAction, SPECTRAL_LIBRARY_MATCH_RESULTS_CLEAR_RESULTS_ACTION);
QAction* pAutoClearAction = new QAction("&AutoClear", pParent);
pAutoClearAction->setAutoRepeat(false);
pAutoClearAction->setCheckable(true);
pAutoClearAction->setStatusTip("Enable/disable clearing existing results before adding new results");
ResultsPage* pPage = dynamic_cast<ResultsPage*>(mpTabWidget->currentWidget());
if (pPage != NULL)
{
pAutoClearAction->setChecked(pPage->getAutoClear());
VERIFYNR(connect(pAutoClearAction, SIGNAL(toggled(bool)), pPage, SLOT(setAutoClear(bool))));
pMenu->addAction(pAutoClearAction, SPECTRAL_LIBRARY_MATCH_RESULTS_AUTOCLEAR_ACTION);
}
QAction* pExpandAllAction = new QAction("&Expand All", pParent);
pExpandAllAction->setAutoRepeat(false);
pExpandAllAction->setStatusTip("Expands all the results nodes on the current page");
VERIFYNR(connect(pExpandAllAction, SIGNAL(triggered()), this, SLOT(expandAllPage())));
pMenu->addAction(pExpandAllAction, SPECTRAL_LIBRARY_MATCH_RESULTS_EXPAND_ALL_ACTION);
QAction* pCollapseAllAction = new QAction("&Collapse All", pParent);
pCollapseAllAction->setAutoRepeat(false);
pCollapseAllAction->setStatusTip("Collapses all the results nodes on the current page");
VERIFYNR(connect(pCollapseAllAction, SIGNAL(triggered()), this, SLOT(collapseAllPage())));
pMenu->addAction(pCollapseAllAction, SPECTRAL_LIBRARY_MATCH_RESULTS_COLLAPSE_ALL_ACTION);
QAction* pDeleteTabAction = new QAction("&Delete Page", pParent);
pDeleteTabAction->setAutoRepeat(false);
pDeleteTabAction->setStatusTip("Deletes the current page");
VERIFYNR(connect(pDeleteTabAction, SIGNAL(triggered()), this, SLOT(deletePage())));
pMenu->addAction(pDeleteTabAction, SPECTRAL_LIBRARY_MATCH_RESULTS_DELETE_PAGE_ACTION);
if (isSessionItem == false)
{
QAction* pLocateAction = new QAction("&Locate Signatures", pParent);
pLocateAction->setAutoRepeat(false);
pLocateAction->setStatusTip("Locates the selected Signatures in the spatial data view");
VERIFYNR(connect(pLocateAction, SIGNAL(triggered()), this, SLOT(locateSignaturesInScene())));
pMenu->addAction(pLocateAction, SPECTRAL_LIBRARY_MATCH_RESULTS_LOCATE_ACTION);
QAction* pCreateAverageAction = new QAction("&Create average Signature", pParent);
pCreateAverageAction->setAutoRepeat(false);
pCreateAverageAction->setStatusTip("Creates an average Signature from the selected "
"Signatures in the spatial data view");
VERIFYNR(connect(pCreateAverageAction, SIGNAL(triggered()), this, SLOT(createAverageSignature())));
pMenu->addAction(pCreateAverageAction, SPECTRAL_LIBRARY_MATCH_RESULTS_CREATE_AVERAGE_ACTION);
}
}
}