Qt Creator plugin
如果把D:\Qt\Qt5.9.8\Tools\QtCreator\lib\qtcreator\plugins\路径下的文件全部删除(只保留Core4.dll文件),然后再启动,那么Qt Creator就变成这样了,简直就是个空壳子:
可见Qt Creator这个庞然大物是由各类插件构成的!把插件拿掉,它就只是一张皮了。
官网下载:
http://download.qt.io/official_releases/qtcreator/
https://github.com/qt-creator/qt-creator
https://github.com/qt-creator/qt-creator/tree/master/src/plugins/helloworld
官网文档:
https://doc.qt.io/qtcreator/index.html
https://doc-snapshots.qt.io/qtcreator-extending/first-plugin.html
网络教程:
https://www.devbean.net/2012/03/qtcreator-plugin-develop-catalog/ Qt Creator 插件开发,翻译自<Writing-Qt-Creator-Plugins.pdf>
https://www.devbean.net/category/qt-creator-%E6%BA%90%E7%A0%81%E5%AD%A6%E4%B9%A0/ Qt Creator 源码学习
开源项目参考:
https://github.com/lexxmark/QtCreator-JsExtensions-Plugin
https://github.com/pasccom/QtcDevPlugin
https://github.com/MichaelSp/QtCreator-Jenkins-Plugin
https://github.com/Eaknyt/QtCreator-ColorPickerPlugin
Qt5:
qtdesigner的源码在Qt Creator源码里面,以插件形式出现
https://github.com/qt-creator/qt-creator/tree/master/src/plugins/designer
Qt4:
Qt Creator源码里面是没有设计器的实际的代码的,它使用的是QtDesigner.dll。
qtdesigner的源码在qtsdk中。
以qt4.8源码为例:qtdesigner.dll的源码路径为\tools\designer\src
https://github.com/qt/qt/tree/4.8/tools/designer
个人笔记:2019/4/19,摘录于Qt Creator源码
projectexplorericons.cpp //ico文件定义 D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\projectexplorer\projectexplorer.cpp bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *error) // run icon const QIcon runSideBarIcon = Utils::Icon::sideBarIcon(Icons::RUN, Icons::RUN_FLAT); const QIcon runIcon = Utils::Icon::combinedIcon({Utils::Icons::RUN_SMALL.icon(), runSideBarIcon}); runMenu->menu()->setIcon(runIcon); runMenu->menu()->setTitle(tr("Run")); msubProjectContextMenu->addMenu(runMenu, ProjectExplorer::Constants::G_PROJECT_RUN); // run action dd->m_runAction = new QAction(runIcon, tr("Run"), this); cmd = ActionManager::registerAction(dd->m_runAction, Constants::RUN); cmd->setAttribute(Command::CA_UpdateText); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); mbuild->addAction(cmd, Constants::G_BUILD_RUN); ModeManager::addAction(cmd->action(), Constants::P_ACTION_RUN); // build session action const QIcon sideBarIcon = Utils::Icon::sideBarIcon(Icons::BUILD, Icons::BUILD_FLAT); const QIcon buildIcon = Utils::Icon::combinedIcon({Icons::BUILD_SMALL.icon(), sideBarIcon}); dd->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this); // build action dd->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); dd->m_buildAction->setIcon(buildIcon); cmd = ActionManager::registerAction(dd->m_buildAction, Constants::BUILD); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(dd->m_buildAction->text()); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B"))); mbuild->addAction(cmd, Constants::G_BUILD_BUILD); // Run without deployment action dd->m_runWithoutDeployAction = new QAction(tr("Run Without Deployment"), this); cmd = ActionManager::registerAction(dd->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY); mbuild->addAction(cmd, Constants::G_BUILD_RUN); dd->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this); cmd = ActionManager::registerAction(dd->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); //左边栏按钮 ModeManager::addAction(dd->m_modeBarBuildAction, Constants::P_ACTION_BUILDPROJECT); //Build ModeManager::addAction(cmd->action(), Constants::P_ACTION_RUN); //Run ModeManager::addAction(&m_visibleStartAction, Constants::P_ACTION_DEBUG); //Debug connect(dd->m_runAction, &QAction::triggered, dd, []() { m_instance->runStartupProject(Constants::NORMAL_RUN_MODE); }); connect(dd->m_runWithoutDeployAction, &QAction::triggered, dd, []() { m_instance->runStartupProject(Constants::NORMAL_RUN_MODE, true); }); D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\debugger\debuggerplugin.cpp connect(&m_debugWithoutDeployAction, &QAction::triggered, this, [] { ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, true); }); void ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu() { m_runWithoutDeployAction->setVisible(m_projectExplorerSettings.deployBeforeRun); } connect(this, &ProjectExplorerPlugin::updateRunActions, dd, &ProjectExplorerPluginPrivate::slotUpdateRunActions); void ProjectExplorerPluginPrivate::slotUpdateRunActions() { QString whyNot; const bool state = ProjectExplorerPlugin::canRunStartupProject(Constants::NORMAL_RUN_MODE, &whyNot); m_runAction->setEnabled(state); m_runAction->setToolTip(whyNot); m_runWithoutDeployAction->setEnabled(state); } void DebuggerPluginPrivate::updateDebugWithoutDeployMenu() { const bool state = ProjectExplorerPlugin::projectExplorerSettings().deployBeforeRun; m_debugWithoutDeployAction.setVisible(state); } connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions, this, &DebuggerPluginPrivate::updatePresetState); void DebuggerPluginPrivate::updatePresetState() { if (m_shuttingDown) return; Project *startupProject = SessionManager::startupProject(); RunConfiguration *startupRunConfig = RunConfiguration::startupRunConfiguration(); DebuggerEngine *currentEngine = EngineManager::currentEngine(); QString whyNot; const bool canRun = ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot); m_debugWithoutDeployAction.setEnabled(canRun); } D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\debugger\images\debugger_continue@2x.png D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\debugger\images\mode_debug_mask@2x.png D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\welcome\images\mode_welcome_mask@2x.png D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\projectexplorer\images\run.png D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\projectexplorer\images\desktopdevice.png D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\projectexplorer\images\BuildSettings.png D:\temp\qt-creator-opensource-src-4.8.2\src\plugins\projectexplorer\images\debugger_start@2x.png