forked from qt-creator/qt-creator
CMakePM: Add "Help" context menu entry for CMake variables
This way one could easily jump to the documentation of a CMake variable e.g. CMAKE_BUILD_TYPE. Change-Id: I1b348f0a1b6c18f0f7cee29ff6409b43c6263f44 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -940,6 +940,18 @@ bool CMakeBuildSettingsWidget::eventFilter(QObject *target, QEvent *event)
|
||||
auto menu = new QMenu(this);
|
||||
connect(menu, &QMenu::triggered, menu, &QMenu::deleteLater);
|
||||
|
||||
auto help = new QAction(tr("Help"), this);
|
||||
menu->addAction(help);
|
||||
connect(help, &QAction::triggered, this, [=] {
|
||||
const CMakeConfigItem item = ConfigModel::dataItemFromIndex(idx).toCMakeConfigItem();
|
||||
|
||||
const CMakeTool *tool = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit());
|
||||
const QString linkUrl = "%1/variable/" + QString::fromUtf8(item.key) + ".html";
|
||||
CMakeTool::openCMakeHelpUrl(tool, linkUrl);
|
||||
});
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
QAction *action = nullptr;
|
||||
if ((action = createForceAction(ConfigModel::DataItem::BOOLEAN, idx)))
|
||||
menu->addAction(action);
|
||||
|
Reference in New Issue
Block a user