本文整理汇总了C++中core::ICore::modeManager方法的典型用法代码示例。如果您正苦于以下问题:C++ ICore::modeManager方法的具体用法?C++ ICore::modeManager怎么用?C++ ICore::modeManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::ICore
的用法示例。
在下文中一共展示了ICore::modeManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
/*! Initializes the plugin. Returns true on success.
Plugins want to register objects with the plugin manager here.
\a error_message can be used to pass an error message to the plugin system,
if there was any.
*/
bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_message)
{
Q_UNUSED(arguments)
Q_UNUSED(error_message)
// Get the primary access point to the workbench.
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
// Create a unique context id for our own view, that will be used for the
// menu entry later.
QList<int> context = QList<int>()
<< core->uniqueIDManager()->uniqueIdentifier(
QLatin1String("HelloWorld.MainView"));
// Create an action to be triggered by a menu entry
QAction *helloWorldAction = new QAction("Say \"&Hello World!\"", this);
connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));
// Register the action with the action manager
Core::ActionManagerInterface *actionManager = core->actionManager();
Core::ICommand *command =
actionManager->registerAction(
helloWorldAction, "HelloWorld.HelloWorldAction", context);
// Create our own menu to place in the Tools menu
Core::IActionContainer *helloWorldMenu =
actionManager->createMenu("HelloWorld.HelloWorldMenu");
QMenu *menu = helloWorldMenu->menu();
menu->setTitle(tr("&Hello World"));
menu->setEnabled(true);
// Add the Hello World action command to the menu
helloWorldMenu->addAction(command);
// Request the Tools menu and add the Hello World menu to it
Core::IActionContainer *toolsMenu =
actionManager->actionContainer(Core::Constants::M_TOOLS);
toolsMenu->addMenu(helloWorldMenu);
// Add a mode with a push button based on BaseMode. Like the BaseView,
// it will unregister itself from the plugin manager when it is deleted.
Core::BaseMode *baseMode = new Core::BaseMode;
baseMode->setUniqueModeName("HelloWorld.HelloWorldMode");
baseMode->setName(tr("Hello world!"));
baseMode->setIcon(QIcon());
baseMode->setPriority(0);
baseMode->setWidget(new QPushButton(tr("Hello World PushButton!")));
addAutoReleasedObject(baseMode);
// Add the Hello World action command to the mode manager (with 0 priority)
Core::ModeManager *modeManager = core->modeManager();
modeManager->addAction(command, 0);
return true;
}
示例2: extensionsInitialized
void InspectorPlugin::extensionsInitialized()
{
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(objectAdded(QObject*)));
connect(pluginManager, SIGNAL(aboutToRemoveObject(QObject*)), SLOT(aboutToRemoveObject(QObject*)));
Core::ICore *core = Core::ICore::instance();
connect(core->modeManager(), SIGNAL(currentModeAboutToChange(Core::IMode*)),
this, SLOT(modeAboutToChange(Core::IMode*)));
}