From 0e9943dd671877adbe13c9316bded21ac762e4dd Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 10 Dec 2024 08:59:43 +0800 Subject: [PATCH 1/7] libs: clang-19 compile fixes * clang-19 seems to be stricter at instantiating code, causing compile errors if functions might not compile * use cpp feature detection macro instead of detecting compilers Change-Id: I47d8b5e325e1528e672fd713d7622305ced1149d Reviewed-by: Eike Ziller --- src/libs/sqlite/sqlitebasestatement.h | 4 ---- src/libs/sqlite/sqliteids.h | 2 +- src/libs/utils/algorithm.h | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libs/sqlite/sqlitebasestatement.h b/src/libs/sqlite/sqlitebasestatement.h index a41be5f4822..4da0cefa7fb 100644 --- a/src/libs/sqlite/sqlitebasestatement.h +++ b/src/libs/sqlite/sqlitebasestatement.h @@ -411,10 +411,6 @@ public: BaseSqliteResultRange(BaseSqliteResultRange &) = delete; BaseSqliteResultRange &operator=(BaseSqliteResultRange &) = delete; - - BaseSqliteResultRange(BaseSqliteResultRange &&other) - : m_statement{std::move(other.resetter)} - {} BaseSqliteResultRange &operator=(BaseSqliteResultRange &&) = delete; iterator begin() & { return iterator{m_statement}; } diff --git a/src/libs/sqlite/sqliteids.h b/src/libs/sqlite/sqliteids.h index 4816cd67d7c..7e4f5de4baa 100644 --- a/src/libs/sqlite/sqliteids.h +++ b/src/libs/sqlite/sqliteids.h @@ -147,7 +147,7 @@ public: friend void convertToString(String &string, CompoundBasicId id) { convertToString(string, id.id); - convertToString(string, id.contextId); + convertToString(string, id.contextId()); } friend bool compareId(CompoundBasicId first, CompoundBasicId second) diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h index f173f9844a5..6814f935237 100644 --- a/src/libs/utils/algorithm.h +++ b/src/libs/utils/algorithm.h @@ -258,7 +258,7 @@ template class C, // result container type typename Result = std::decay_t>, typename ResultContainer = C> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, F function); -#ifdef Q_CC_CLANG +#if __cpp_template_template_args < 201611L // "Matching of template template-arguments excludes compatible templates" // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0522r0.html (P0522R0) // in C++17 makes the above match e.g. C=std::vector even though that takes two @@ -833,7 +833,7 @@ Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, F function) return transform(std::forward(container), function); } -#ifdef Q_CC_CLANG +#if __cpp_template_template_args < 201611L template class C, // result container type typename SC, // input container type typename F, // function type From 577b5f577ef769fa9a43616e8c4623bfce8084a7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 11 Dec 2024 09:21:31 +0100 Subject: [PATCH 2/7] Fix the loading of C++ plugins from user directory `appInfo().userPluginsRoot` already contains the versioned directory for the "current" version. Before adding all the backwards compatible version directories we need to step up once. Amends 165ad2784e41faa5b7b388a4762e4f27f93ee405 Change-Id: I73456629654ff5f65dd8a2a9c2fc1d935a600d5f Reviewed-by: Marcus Tillmanns --- src/app/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 1767cbade16..365887dfc4e 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -196,7 +196,7 @@ static inline FilePaths getPluginPaths() // "%LOCALAPPDATA%\QtProject\qtcreator" on Windows Vista and later // "$XDG_DATA_HOME/data/QtProject/qtcreator" or "~/.local/share/data/QtProject/qtcreator" on Linux // "~/Library/Application Support/QtProject/Qt Creator" on Mac - const FilePath userPluginPath = appInfo().userPluginsRoot; + const FilePath userPluginPath = appInfo().userPluginsRoot.parentDir(); // Qt Creator X.Y.Z can load plugins from X.Y.(Z-1) etc, so add current and previous // patch versions From 0cae52c16cda42f9718b77c399d27044311d987b Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 11 Dec 2024 08:41:05 +0100 Subject: [PATCH 3/7] JsonWizard: Fix warning On macOS, pixelMetric(QStyle::PM_LayoutHorizontalSpacing) will always return -1. ``` QWidget::setMinimumSize: (/QWidget) Negative sizes (-1,-1) are not possible QWidget::setMaximumSize: (/QWidget) Negative sizes (-1,-1) are not possible QWidget::setMinimumSize: (/QWidget) Negative sizes (-1,-1) are not possible QWidget::setMaximumSize: (/QWidget) Negative sizes (-1,-1) are not possible ``` Change-Id: I87d83af9f739dec6cdb898880ad8e9e9eaa411f9 Reviewed-by: Alessandro Portale --- src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index d3d747c1a89..5196eaa8480 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -474,8 +474,8 @@ QWidget *SpacerField::createWidget(const QString &displayName, JsonFieldPage *pa Q_UNUSED(page) int hspace = QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); int vspace = QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing); - int hsize = hspace * m_factor; - int vsize = vspace * m_factor; + int hsize = qMax(0, hspace * m_factor); + int vsize = qMax(0, vspace * m_factor); auto w = new QWidget(); w->setMinimumSize(hsize, vsize); From 746fd23e9914253a343e584109ed3e5dd932adf0 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 9 Dec 2024 12:48:42 +0100 Subject: [PATCH 4/7] ProjectExplorer: Add some soft asserts in toolchain factory functions These might help with diagnosing mysterious crashes observed on user machines. Task-number: QTCREATORBUG-32127 Change-Id: Ia41cb4bd1f68717cec255a131d02c3b86f87b769 Reviewed-by: Eike Ziller --- src/plugins/projectexplorer/toolchain.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index 50d81a8ff07..5468b566d43 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -187,7 +187,9 @@ QString Toolchain::detectionSource() const ToolchainFactory *Toolchain::factory() const { - return ToolchainFactory::factoryForType(typeId()); + ToolchainFactory * const factory = ToolchainFactory::factoryForType(typeId()); + QTC_ASSERT(factory, qDebug() << typeId()); + return factory; } QByteArray Toolchain::id() const @@ -741,12 +743,11 @@ void ToolchainFactory::autoDetectionToMap(Store &data, bool detected) Toolchain *ToolchainFactory::createToolchain(Id toolchainType) { - for (ToolchainFactory *factory : std::as_const(toolchainFactories())) { - if (factory->m_supportedToolchainType == toolchainType) { - if (Toolchain *tc = factory->create()) { - tc->d->m_typeId = toolchainType; - return tc; - } + if (ToolchainFactory * const factory = factoryForType(toolchainType)) { + if (Toolchain * const tc = factory->create()) { + QTC_ASSERT(tc->typeId() == toolchainType, qDebug() << toolchainType.toSetting()); + tc->d->m_typeId = toolchainType; // FIXME: Redundant? + return tc; } } return nullptr; From fc583ef9f6d7e8ddf800a760810aeb24d23ab0f3 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 27 Nov 2024 14:56:18 +0100 Subject: [PATCH 5/7] ExtensionSystem: Add function to set terms as accepted Change-Id: Ic6ca83a0d2b93b20178dcf3adef0156e520e79b4 Reviewed-by: Eike Ziller --- src/libs/extensionsystem/pluginmanager.cpp | 9 +++++++++ src/libs/extensionsystem/pluginmanager.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index bae7aea31f4..8ebf877bcdd 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -2072,4 +2072,13 @@ void PluginManager::setAcceptTermsAndConditionsCallback( d->setAcceptTermsAndConditionsCallback(callback); } +void PluginManager::setTermsAndConditionsAccepted(PluginSpec *spec) +{ + if (spec->termsAndConditions()) { + d->pluginsWithAcceptedTermsAndConditions.append(spec->id()); + if (d->settings) + d->settings->setValue(C_TANDCACCEPTED_PLUGINS, d->pluginsWithAcceptedTermsAndConditions); + } +} + } // ExtensionSystem diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h index 6dee40b2a3d..7fafb9b81e2 100644 --- a/src/libs/extensionsystem/pluginmanager.h +++ b/src/libs/extensionsystem/pluginmanager.h @@ -138,6 +138,7 @@ public: static QString systemInformation(); void setAcceptTermsAndConditionsCallback(const std::function &callback); + void setTermsAndConditionsAccepted(PluginSpec *spec); signals: void objectAdded(QObject *obj); From 54c6a7739225a238a42927282f8b0c199b0110e5 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 27 Nov 2024 14:58:34 +0100 Subject: [PATCH 6/7] Core: Set Terms as accepted during install wizard Change-Id: Idff08bcbf4e425441bcc6bb22c1e9fc1978a5ea1 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/plugininstallwizard.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/coreplugin/plugininstallwizard.cpp b/src/plugins/coreplugin/plugininstallwizard.cpp index bdae4e6395f..796db4843d0 100644 --- a/src/plugins/coreplugin/plugininstallwizard.cpp +++ b/src/plugins/coreplugin/plugininstallwizard.cpp @@ -499,6 +499,10 @@ bool executePluginInstallWizard(const FilePath &archive) if (!install()) return false; + // install() would have failed if the user did not accept the terms and conditions + // so we can safely set them as accepted here. + PluginManager::instance()->setTermsAndConditionsAccepted(data.pluginSpec.get()); + if (data.loadImmediately) { auto spec = data.pluginSpec.release(); spec->setEnabledBySettings(true); From e30a8a390235e7e38ea21bfc139ea9ec1d07d75b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 11 Dec 2024 13:50:47 +0100 Subject: [PATCH 7/7] Fix Ctrl+Tab Amends f6d57999d80c04f930916197806e3cd47b88d81c That patch accidentally clears the document list before opening the selected editor, instead of the other way round. Change-Id: Ia694fe009b6922b2257da787346d3505f533a0c4 Reviewed-by: David Schulz --- src/plugins/coreplugin/editormanager/openeditorswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index 70dc13d2bd3..8da2ed5eba3 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -155,8 +155,8 @@ OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) void OpenEditorsWindow::selectAndHide() { - setVisible(false); selectEditor(m_editorView->currentItem()); + setVisible(false); } void OpenEditorsWindow::setVisible(bool visible)