diff options
Diffstat (limited to 'src/plugins/qtsupport')
-rw-r--r-- | src/plugins/qtsupport/baseqtversion.cpp | 25 | ||||
-rw-r--r-- | src/plugins/qtsupport/baseqtversion.h | 2 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 2780ab16db..bf89085e57 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1478,16 +1478,27 @@ FileName BaseQtVersion::sourcePath(const QHash<QString, QString> &versionInfo) return FileName::fromUserInput(sourcePath); } -bool BaseQtVersion::isInSourceDirectory(const Utils::FileName &filePath) +bool BaseQtVersion::isSubProject(const Utils::FileName &filePath) { const Utils::FileName &source = sourcePath(); - if (source.isEmpty()) - return false; - QDir dir = QDir(source.toString()); - if (dir.dirName() == QLatin1String("qtbase")) - dir.cdUp(); + if (!source.isEmpty()) { + QDir dir = QDir(source.toString()); + if (dir.dirName() == QLatin1String("qtbase")) + dir.cdUp(); + + if (filePath.isChildOf(dir)) + return true; + } + + const QString &examples = examplesPath(); + if (!examples.isEmpty() && filePath.isChildOf(QDir(examples))) + return true; + + const QString &demos = demosPath(); + if (!demos.isEmpty() && filePath.isChildOf(QDir(demos))) + return true; - return filePath.isChildOf(dir); + return false; } bool BaseQtVersion::isQmlDebuggingSupported(Kit *k, QString *reason) diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index a04510d0ba..e876c24bc9 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -124,7 +124,7 @@ public: virtual Utils::Environment qmakeRunEnvironment() const; virtual Utils::FileName sourcePath() const; - bool isInSourceDirectory(const Utils::FileName &filePath); + bool isSubProject(const Utils::FileName &filePath); // used by UiCodeModelSupport virtual QString uicCommand() const; |