本文整理汇总了C++中WindowManager::getMainWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowManager::getMainWindow方法的具体用法?C++ WindowManager::getMainWindow怎么用?C++ WindowManager::getMainWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowManager
的用法示例。
在下文中一共展示了WindowManager::getMainWindow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showContextMenu
void FrameAttachmentPoint::showContextMenu(QPoint point)
{
//Show menus with all attached frames and submenu where to attach it to
clearActionReceivers();
WindowManager* windowManager = Carbon::get()->getWindowManager();
QMenu menu(windowManager->getMainWindow());
QMenu* submenu;
QAction* action;
//For all attached frames, add frame menu
int frame = 0;
for (auto it = mAttachedFrames.begin(); it != mAttachedFrames.end(); it++)
{
submenu = menu.addMenu((*it)->getCaption());
//for all possible targets, add commands
{
NumberedActionReceiver* receiver;
//Copy command
receiver = new NumberedActionReceiver(frame, COMMAND_COPY);
mActionReceivers.push_back(receiver);
connect(receiver, SIGNAL(actionReceived(int,int)), this, SLOT(onContextMenuClick(int,int)));
action = submenu->addAction(QIcon(":copy"), "Copy", receiver, SLOT(receiveAction()));
action->setToolTip("Create a copy of the plugin.");
if (!PluginFactory::getFactory().canCreatePlugin((*it)->getClassId())) //Disable copy if plugin cant be created anymore
action->setEnabled(false);
//Delete command
receiver = new NumberedActionReceiver(frame, COMMAND_DELETE);
mActionReceivers.push_back(receiver);
connect(receiver, SIGNAL(actionReceived(int,int)), this, SLOT(onContextMenuClick(int,int)));
action = submenu->addAction(QIcon(":delete"), "Delete", receiver, SLOT(receiveAction()));
action->setToolTip("Delete the plugin.");
}
submenu->addSeparator();
//for all possible targets, add target frames
int target = COMMAND_MAX_ID;
for (auto tar_it = windowManager->getFrameAttachmentPoints().begin(); tar_it != windowManager->getFrameAttachmentPoints().end(); tar_it++)
{
NumberedActionReceiver* receiver = new NumberedActionReceiver(frame, target);
mActionReceivers.push_back(receiver);
connect(receiver, SIGNAL(actionReceived(int,int)), this, SLOT(onContextMenuClick(int,int)));
if (tar_it->second == this)
action = submenu->addAction(QIcon(":accept"), tar_it->second->getName(), receiver, SLOT(receiveAction()));
else
action = submenu->addAction(tar_it->second->getName(), receiver, SLOT(receiveAction()));
target++;
}
frame++;
}
menu.exec(mAttachmentPoint->mapToGlobal(point));
}