//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildFileMenu(QMenu& menu)
{
  QString objectName = menu.objectName();
  Ui::pqFileMenuBuilder ui;
  ui.setupUi(&menu);
  // since the UI file tends to change the name of the menu.
  menu.setObjectName(objectName);

  QObject::connect(ui.actionFileExit, SIGNAL(triggered()),
    pqApplicationCore::instance(), SLOT(quit()));

  // now setup reactions.
  new pqLoadStateReaction(ui.actionFileOpen);
  new pqRecentFilesMenu(*ui.menuRecentFiles, ui.menuRecentFiles);

  new pqLoadStateReaction(ui.actionFileLoadServerState);
  new pqSaveStateReaction(ui.actionFileSaveServerState);

  new pqServerConnectReaction(ui.actionServerConnect);
  new pqServerDisconnectReaction(ui.actionServerDisconnect);

  new pqSaveScreenshotReaction(ui.actionFileSaveScreenshot);
  new pqSaveAnimationReaction(ui.actionFileSaveAnimation);
  new pqSaveAnimationGeometryReaction(ui.actionFileSaveGeometry);

  new pqExportReaction(ui.actionExport);
  new pqSaveDataReaction(ui.actionFileSaveData);
}
示例#2
0
文件: qt_menu.cpp 项目: wgsyd/wgtf
QMenu* QtMenu::addMenuPath(QMenu& qMenu, const char* path)
{
	QMenu* menu = &qMenu;
	while (path != nullptr)
	{
		auto tok = strchr(path, '.');
		auto subPath = tok != nullptr ? QString::fromUtf8(path, tok - path) : path;
		if (!subPath.isEmpty())
		{
			QMenu* subMenu = nullptr;
			auto actions = menu->actions();
			for (auto& action : actions)
			{
				subMenu = action->menu();
				if (subMenu != nullptr &&
					subMenu->objectName() == subPath)
				{
					break;
				}
				subMenu = nullptr;
			}

			if (subMenu == nullptr)
			{
				subMenu = menu->addMenu(subPath);
				subMenu->setObjectName(subPath);
			}
			menu = subMenu;
		}
		path = tok != nullptr ? tok + 1 : nullptr;
	}
	return menu;
}
示例#3
0
QString QMenuProto::toString() const
{
  QMenu *item = qscriptvalue_cast<QMenu*>(thisObject());
  if (item)
    return QString("[QMenu named %1: %2]")
                  .arg(item->objectName())
                  .arg(item->title());
  return QString("QMenu(unknown)");
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildEditMenu(QMenu& menu)
{
  QString objectName = menu.objectName();
  Ui::pqEditMenuBuilder ui;
  ui.setupUi(&menu);
  // since the UI file tends to change the name of the menu.
  menu.setObjectName(objectName);

  new pqUndoRedoReaction(ui.actionEditUndo, true);
  new pqUndoRedoReaction(ui.actionEditRedo, false);
  new pqCameraUndoRedoReaction(ui.actionEditCameraUndo, true);
  new pqCameraUndoRedoReaction(ui.actionEditCameraRedo, false);
  new pqChangePipelineInputReaction(ui.actionChangeInput);
  new pqIgnoreSourceTimeReaction(ui.actionIgnoreTime);
  new pqDeleteReaction(ui.actionDelete);
  new pqDeleteReaction(ui.actionDelete_All, true);
  new pqCopyReaction(ui.actionCopy);
  new pqCopyReaction(ui.actionPaste, true);
  new pqApplicationSettingsReaction(ui.actionEditSettings);
  new pqViewSettingsReaction(ui.actionEditViewSettings);
  new pqDataQueryReaction(ui.actionQuery);
}