Qmake: Allow removing QMLJS from project languages

E.g. when the last use of the libraries was removed from .pro files.

This also makes the use more similar to the other build systems and
allows making Project::{add,remove}ProjectLanguage private.

Change-Id: Ib23d83f2fb5aab728b344c164a1331429b44e345
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-08-05 16:41:20 +02:00
parent 22ecef0444
commit d932b8535a
2 changed files with 4 additions and 4 deletions

View File

@@ -174,7 +174,6 @@ public:
void setDisplayName(const QString &name); void setDisplayName(const QString &name);
void setProjectLanguage(Utils::Id id, bool enabled); void setProjectLanguage(Utils::Id id, bool enabled);
void addProjectLanguage(Utils::Id id);
void setExtraData(const QString &key, const QVariant &data); void setExtraData(const QString &key, const QVariant &data);
QVariant extraData(const QString &key) const; QVariant extraData(const QString &key) const;
@@ -221,7 +220,6 @@ protected:
void setId(Utils::Id id); void setId(Utils::Id id);
void setProjectLanguages(Core::Context language); void setProjectLanguages(Core::Context language);
void removeProjectLanguage(Utils::Id id);
void setHasMakeInstallEquivalent(bool enabled); void setHasMakeInstallEquivalent(bool enabled);
void setNeedsBuildConfigurations(bool value); void setNeedsBuildConfigurations(bool value);
@@ -235,6 +233,9 @@ protected:
private: private:
void addTarget(std::unique_ptr<Target> &&target); void addTarget(std::unique_ptr<Target> &&target);
void addProjectLanguage(Utils::Id id);
void removeProjectLanguage(Utils::Id id);
void handleSubTreeChanged(FolderNode *node); void handleSubTreeChanged(FolderNode *node);
void setActiveTarget(Target *target); void setActiveTarget(Target *target);

View File

@@ -454,8 +454,7 @@ void QmakeBuildSystem::updateQmlJSCodeModel()
// library then chances of the project being a QML project is quite high. // library then chances of the project being a QML project is quite high.
// This assumption fails when there are no QDeclarativeEngine/QDeclarativeView (QtQuick 1) // This assumption fails when there are no QDeclarativeEngine/QDeclarativeView (QtQuick 1)
// or QQmlEngine/QQuickView (QtQuick 2) instances. // or QQmlEngine/QQuickView (QtQuick 2) instances.
if (hasQmlLib) project()->setProjectLanguage(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID, hasQmlLib);
project()->addProjectLanguage(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID);
projectInfo.activeResourceFiles.removeDuplicates(); projectInfo.activeResourceFiles.removeDuplicates();
projectInfo.allResourceFiles.removeDuplicates(); projectInfo.allResourceFiles.removeDuplicates();