diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index fae8f9ea239..347c8e794c5 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -1143,7 +1143,10 @@ void CMakeConfigurationKitAspect::setKitDefaultConfigHash(ProjectExplorer::Kit * expanded.value = item.expandedValue(k).toUtf8(); return expanded; }); - const QByteArray kitHash = computeDefaultConfigHash(defaultConfigExpanded); + const CMakeTool *const tool = CMakeKitAspect::cmakeTool(k); + const QByteArray kitHash = computeDefaultConfigHash(defaultConfigExpanded, + tool ? tool->cmakeExecutable() + : FilePath()); CMakeConfig config = configuration(k); config.append(CMakeConfigItem(QTC_KIT_DEFAULT_CONFIG_HASH, CMakeConfigItem::INTERNAL, kitHash)); @@ -1159,7 +1162,8 @@ CMakeConfigItem CMakeConfigurationKitAspect::kitDefaultConfigHashItem(const Proj }); } -QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConfig &config) +QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConfig &config, + const FilePath &cmakeBinary) { const CMakeConfig defaultConfig = defaultConfiguration(nullptr); const QByteArray configValues = std::accumulate(defaultConfig.begin(), @@ -1169,7 +1173,11 @@ QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConf const CMakeConfigItem &item) { return sum += config.valueOf(item.key); }); - return QCryptographicHash::hash(configValues, QCryptographicHash::Md5).toHex(); + return QCryptographicHash::hash(cmakeBinary.caseSensitivity() == Qt::CaseInsensitive + ? configValues.toLower() + : configValues, + QCryptographicHash::Md5) + .toHex(); } QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.h b/src/plugins/cmakeprojectmanager/cmakekitinformation.h index 8237bc9fdc6..bf056f99e23 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.h +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.h @@ -93,7 +93,8 @@ public: static void setKitDefaultConfigHash(ProjectExplorer::Kit *k); static CMakeConfigItem kitDefaultConfigHashItem(const ProjectExplorer::Kit *k); - static QByteArray computeDefaultConfigHash(const CMakeConfig &config); + static QByteArray computeDefaultConfigHash(const CMakeConfig &config, + const Utils::FilePath &cmakeBinary); // KitAspect interface ProjectExplorer::Tasks validate(const ProjectExplorer::Kit *k) const final; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index ccd7accedfc..1763d4e8c5c 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -464,6 +464,35 @@ void updateCompilerPaths(CMakeConfig &config, const Environment &env) updateRelativePath("CMAKE_CXX_COMPILER"); } +void updateConfigWithDirectoryData(CMakeConfig &config, const std::unique_ptr &data) +{ + auto updateCompilerValue = [&config, &data](const QByteArray &key, const Utils::Id &language) { + auto it = std::find_if(config.begin(), config.end(), [&key](const CMakeConfigItem &ci) { + return ci.key == key; + }); + + auto tcd = Utils::findOrDefault(data->toolChains, + [&language](const ToolChainDescription &t) { + return t.language == language; + }); + + if (it != config.end() && it->value.isEmpty()) + it->value = tcd.compilerPath.toString().toUtf8(); + else + config << CMakeConfigItem(key, + CMakeConfigItem::FILEPATH, + tcd.compilerPath.toString().toUtf8()); + }; + + updateCompilerValue("CMAKE_C_COMPILER", ProjectExplorer::Constants::C_LANGUAGE_ID); + updateCompilerValue("CMAKE_CXX_COMPILER", ProjectExplorer::Constants::CXX_LANGUAGE_ID); + + if (data->qt.qt) + config << CMakeConfigItem("QT_QMAKE_EXECUTABLE", + CMakeConfigItem::FILEPATH, + data->qt.qt->qmakeFilePath().toString().toUtf8()); +} + QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, QString *warningMessage) const { @@ -550,8 +579,6 @@ QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, CMakeConfigItem::STRING, configurePreset.generator.value().toUtf8()); } - data->cmakePresetDefaultConfigHash = CMakeConfigurationKitAspect::computeDefaultConfigHash( - config); const FilePath qmake = qmakeFromCMakeCache(config); if (!qmake.isEmpty()) @@ -560,6 +587,12 @@ QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, // ToolChains: data->toolChains = extractToolChainsFromCache(config); + // Update QT_QMAKE_EXECUTABLE and CMAKE_C|XX_COMPILER config values + updateConfigWithDirectoryData(config, data); + + data->cmakePresetDefaultConfigHash + = CMakeConfigurationKitAspect::computeDefaultConfigHash(config, data->cmakeBinary); + QByteArrayList buildConfigurationTypes = {cache.valueOf("CMAKE_BUILD_TYPE")}; if (buildConfigurationTypes.front().isEmpty()) { buildConfigurationTypes.clear(); diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 0cf089823ab..91b9818de7f 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -252,6 +252,7 @@ QtOptionsPageWidget::QtOptionsPageWidget() m_nameEdit = new QLineEdit; m_qmakePath = new QLabel; + m_qmakePath->setObjectName("qmakePath"); // for Squish m_qmakePath->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_qmakePath->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse); diff --git a/tests/manual/cmakepresets/CMakePresets.json b/tests/manual/cmakepresets/CMakePresets.json index 90e2df58369..da98c991baa 100644 --- a/tests/manual/cmakepresets/CMakePresets.json +++ b/tests/manual/cmakepresets/CMakePresets.json @@ -12,7 +12,7 @@ "generator": "Ninja", "installDir": "../inst-${presetName}", "cacheVariables": { - "CMAKE_PREFIX_PATH": "$env{SYSTEMDRIVE}/Qt/6.3.2/mingw_64" + "CMAKE_PREFIX_PATH": "$env{SYSTEMDRIVE}/Qt/6.4.2/mingw_64" }, "condition": { "type": "equals", @@ -34,7 +34,7 @@ "inherits" : "mingw", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release", - "CMAKE_PREFIX_PATH": "$env{SystemDrive}/Qt/6.3.2/mingw_64" + "CMAKE_PREFIX_PATH": "$env{SystemDrive}/Qt/6.4.2/mingw_64" } }, { @@ -56,7 +56,7 @@ }, "environment" : { "HOST_SYSTEM_NAME": "Windows", - "QT_VERSION": "6.3.2" + "QT_VERSION": "6.4.2" } }, { @@ -64,7 +64,7 @@ "displayName": "Visual C++ 2019 x64 Ninja", "generator": "Ninja", "binaryDir": "${sourceDir}/build-${presetName}", - "toolchainFile" : "c:/Qt/6.3.2/msvc2019_64/lib/cmake/Qt6/qt.toolchain.cmake", + "toolchainFile" : "c:/Qt/6.4.2/msvc2019_64/lib/cmake/Qt6/qt.toolchain.cmake", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }, @@ -92,7 +92,7 @@ "displayName": "Linux GCC", "generator": "Ninja", "binaryDir": "${sourceDir}/build-${presetName}", - "toolchainFile" : "$env{HOME}/Qt/6.3.2/gcc_64/lib/cmake/Qt6/qt.toolchain.cmake", + "toolchainFile" : "$env{HOME}/Qt/6.4.2/gcc_64/lib/cmake/Qt6/qt.toolchain.cmake", "condition" : { "type": "equals", "lhs": "${hostSystemName}", diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 91c39b40ab9..9fe97cf9c9c 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -418,7 +418,7 @@ def __chooseTargets__(targets, availableTargets=None, additionalFunc=None): "window=':Qt Creator_Core::Internal::MainWindow' " "summaryText='%s' visible='1'}" % Targets.getStringForTarget(current)) - detailsButton = getChildByClass(detailsWidget, "Utils::DetailsButton") + detailsButton = getChildByClass(detailsWidget, "QToolButton") clickButton(detailsButton) additionalFunc() clickButton(detailsButton) diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index 35914f5237c..6b6c2d0f754 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -40,17 +40,16 @@ def main(): myCompTE = "SampleApp.SampleApp.qml\\.qrc./.MyComponent\\.qml" # there should be new QML file generated with name "MyComponent.qml" try: - waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", myCompTE, 5000) + # openDocument() doesn't wait for expected elements, so it might be faster than the updates + # to the tree. Explicitly wait here to avoid timing issues. Using wFOI() instead of + # snooze() allows to proceed earlier, just in case it can find the item. + waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", + addBranchWildcardToRoot(myCompTE), 2000) except: - try: - waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", addBranchWildcardToRoot(myCompTE), 1000) - except: - test.fail("Refactoring failed - file MyComponent.qml was not generated properly in project explorer") - saveAndExit() - return - test.passes("Refactoring - file MyComponent.qml was generated properly in project explorer") + pass # open MyComponent.qml file for verification - if not openDocument(myCompTE): + if not test.verify(openDocument(myCompTE), + "Was MyComponent.qml properly generated in project explorer?"): test.fatal("Could not open MyComponent.qml.") saveAndExit() return diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index 7d42d2fba84..83c7171388d 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -31,6 +31,13 @@ def __checkKits__(): mouseClick(waitForObjectItem(":Options_QListView", "Kits")) # check compilers expectedCompilers = __getExpectedCompilers__() + llvmForBuild = os.getenv("SYSTEST_LLVM_FROM_BUILD", None) + if llvmForBuild is not None: + internalClangExe = os.path.join(llvmForBuild, "bin", "clang") + if platform.system() in ("Microsoft", "Windows"): + internalClangExe.append(".exe") + if os.path.exists(internalClangExe): + expectedCompilers.append(internalClangExe) foundCompilers = [] foundCompilerNames = [] clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Compilers") diff --git a/tests/system/suite_tools/tst_designer_edit/test.py b/tests/system/suite_tools/tst_designer_edit/test.py index 272b38f59eb..96e289df885 100644 --- a/tests/system/suite_tools/tst_designer_edit/test.py +++ b/tests/system/suite_tools/tst_designer_edit/test.py @@ -67,8 +67,8 @@ def performEditMenu(): "visible='1' window=':Qt Creator_Core::Internal::MainWindow'} " "type='QTreeView' unnamed='1' visible='1'}") tree = __iterateChildren__(objInspTV.model(), None) - expectedMenuSequence = [["menuSquishTestFile", 2], ["actionOpen", 3], ["separator", 3], - ["actionShutdown", 3]] + expectedMenuSequence = [["menuSquishTestFile", 2], ["actionOpen", 3], ["actionShutdown", 3], + ["separator", 3]] seqStart = tree.index(expectedMenuSequence[0]) test.verify(seqStart != -1 and tree[seqStart:seqStart + 4] == expectedMenuSequence, "Verify Object Inspector contains expected menu inclusive children.")