forked from qt-creator/qt-creator
QmlProject: Disable or hide qmlproject related actions
Generate CMake Build files is only relevant for .qmlprojects and should only be enabled for those. Export as latest Project Format is only relevant for QDS and should be hidden in Qt Creator. Task-number: QTCREATORBUG-27935 Change-Id: Iac6ca6927443a92dfb501f76c855fd641aaf10da Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -90,11 +90,14 @@ void generateMenuEntry(QObject *parent)
|
|||||||
Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.CreateCMakeLists");
|
Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.CreateCMakeLists");
|
||||||
menu->addAction(cmd, Core::Constants::G_FILE_EXPORT);
|
menu->addAction(cmd, Core::Constants::G_FILE_EXPORT);
|
||||||
|
|
||||||
action->setEnabled(ProjectExplorer::SessionManager::startupProject() != nullptr);
|
action->setEnabled(false);
|
||||||
QObject::connect(ProjectExplorer::SessionManager::instance(),
|
QObject::connect(ProjectExplorer::SessionManager::instance(),
|
||||||
&ProjectExplorer::SessionManager::startupProjectChanged, [action]() {
|
&ProjectExplorer::SessionManager::startupProjectChanged,
|
||||||
action->setEnabled(ProjectExplorer::SessionManager::startupProject() != nullptr);
|
[action]() {
|
||||||
});
|
auto qmlProject = qobject_cast<QmlProject *>(
|
||||||
|
ProjectExplorer::SessionManager::startupProject());
|
||||||
|
action->setEnabled(qmlProject != nullptr);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void onGenerateCmakeLists()
|
void onGenerateCmakeLists()
|
||||||
|
@@ -379,7 +379,8 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GenerateCmake::generateMenuEntry(this);
|
GenerateCmake::generateMenuEntry(this);
|
||||||
GenerateCmake::CmakeProjectConverter::generateMenuEntry(this);
|
if (QmlProject::isQtDesignStudio())
|
||||||
|
GenerateCmake::CmakeProjectConverter::generateMenuEntry(this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user