From 25f8934b394a508ec5a6d097ff22015356908322 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 4 Jun 2024 09:04:29 +0200 Subject: [PATCH 01/45] TextEditor: Inline SnippetSettings class It's effectively just one string and wasn't aspectified. Change-Id: Ifdfabddbd3d9e089487eefd1591db267685a582b Reviewed-by: David Schulz --- src/plugins/texteditor/CMakeLists.txt | 1 - .../texteditor/snippets/snippetssettings.cpp | 46 ------------------- .../texteditor/snippets/snippetssettings.h | 37 --------------- .../snippets/snippetssettingspage.cpp | 21 ++++----- src/plugins/texteditor/texteditor.qbs | 2 - 5 files changed, 8 insertions(+), 99 deletions(-) delete mode 100644 src/plugins/texteditor/snippets/snippetssettings.cpp delete mode 100644 src/plugins/texteditor/snippets/snippetssettings.h diff --git a/src/plugins/texteditor/CMakeLists.txt b/src/plugins/texteditor/CMakeLists.txt index 978d0de86a7..22abf9d8a1e 100644 --- a/src/plugins/texteditor/CMakeLists.txt +++ b/src/plugins/texteditor/CMakeLists.txt @@ -92,7 +92,6 @@ add_qtc_plugin(TextEditor snippets/snippetparser.cpp snippets/snippetparser.h snippets/snippetprovider.cpp snippets/snippetprovider.h snippets/snippetscollection.cpp snippets/snippetscollection.h - snippets/snippetssettings.cpp snippets/snippetssettings.h snippets/snippetssettingspage.cpp snippets/snippetssettingspage.h storagesettings.cpp storagesettings.h syntaxhighlighter.cpp syntaxhighlighter.h diff --git a/src/plugins/texteditor/snippets/snippetssettings.cpp b/src/plugins/texteditor/snippets/snippetssettings.cpp deleted file mode 100644 index cce25bc7109..00000000000 --- a/src/plugins/texteditor/snippets/snippetssettings.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "snippetssettings.h" - -#include - -using namespace Utils; - -namespace TextEditor { - -const char kGroupPostfix[] = "SnippetsSettings"; -const char kLastUsedSnippetGroup[] = "LastUsedSnippetGroup"; - -void SnippetsSettings::toSettings(const Key &category, QtcSettings *s) const -{ - const Key group = category + kGroupPostfix; - s->beginGroup(group); - s->setValue(kLastUsedSnippetGroup, m_lastUsedSnippetGroup); - s->endGroup(); -} - -void SnippetsSettings::fromSettings(const Key &category, QtcSettings *s) -{ - const Key group = category + kGroupPostfix; - s->beginGroup(group); - m_lastUsedSnippetGroup = s->value(kLastUsedSnippetGroup, QString()).toString(); - s->endGroup(); -} - -void SnippetsSettings::setLastUsedSnippetGroup(const QString &lastUsed) -{ - m_lastUsedSnippetGroup = lastUsed; -} - -const QString &SnippetsSettings::lastUsedSnippetGroup() const -{ - return m_lastUsedSnippetGroup; -} - -bool SnippetsSettings::equals(const SnippetsSettings &snippetsSettings) const -{ - return m_lastUsedSnippetGroup == snippetsSettings.m_lastUsedSnippetGroup; -} - -} // TextEditor diff --git a/src/plugins/texteditor/snippets/snippetssettings.h b/src/plugins/texteditor/snippets/snippetssettings.h deleted file mode 100644 index 732d51f6716..00000000000 --- a/src/plugins/texteditor/snippets/snippetssettings.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -namespace Utils { -class Key; -class QtcSettings; -} // Utils - -namespace TextEditor { - -class SnippetsSettings -{ -public: - SnippetsSettings() = default; - - void toSettings(const Utils::Key &category, Utils::QtcSettings *s) const; - void fromSettings(const Utils::Key &category, Utils::QtcSettings *s); - - void setLastUsedSnippetGroup(const QString &lastUsed); - const QString &lastUsedSnippetGroup() const; - - bool equals(const SnippetsSettings &snippetsSettings) const; - - friend bool operator==(const SnippetsSettings &a, const SnippetsSettings &b) - { return a.equals(b); } - friend bool operator!=(const SnippetsSettings &a, const SnippetsSettings &b) - { return !a.equals(b); } - -private: - QString m_lastUsedSnippetGroup; -}; - -} // TextEditor diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp index 51deff5ad1f..546d532bbf3 100644 --- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp +++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp @@ -7,7 +7,6 @@ #include "snippetprovider.h" #include "snippet.h" #include "snippetscollection.h" -#include "snippetssettings.h" #include "../fontsettings.h" #include "../textdocument.h" #include "../texteditorconstants.h" @@ -39,6 +38,8 @@ using namespace Utils; namespace TextEditor::Internal { +const char kLastUsedSnippetGroup[] = "TextSnippetsSettings/LastUsedSnippetGroup"; + // SnippetsTableModel class SnippetsTableModel : public QAbstractTableModel @@ -244,8 +245,6 @@ void SnippetsTableModel::replaceSnippet(const Snippet &snippet, const QModelInde } } -// SnippetsSettingsWidget - class SnippetsSettingsWidget : public Core::IOptionsPageWidget { public: @@ -275,10 +274,9 @@ private: bool settingsChanged() const; void writeSettings(); - const Key m_settingsPrefix{"Text"}; SnippetsTableModel m_model; bool m_snippetsCollectionChanged = false; - SnippetsSettings m_settings; + QString m_lastUsedSnippetGroup; QStackedWidget *m_snippetsEditorStack; QComboBox *m_groupCombo; @@ -407,9 +405,8 @@ void SnippetsSettingsWidget::loadSettings() if (m_groupCombo->count() == 0) return; - m_settings.fromSettings(m_settingsPrefix, Core::ICore::settings()); - const QString &lastGroupName = m_settings.lastUsedSnippetGroup(); - const int index = m_groupCombo->findText(lastGroupName); + m_lastUsedSnippetGroup = Core::ICore::settings()->value(kLastUsedSnippetGroup, QString()).toString(); + const int index = m_groupCombo->findText(m_lastUsedSnippetGroup); if (index != -1) m_groupCombo->setCurrentIndex(index); else @@ -421,15 +418,13 @@ void SnippetsSettingsWidget::writeSettings() if (m_groupCombo->count() == 0) return; - m_settings.setLastUsedSnippetGroup(m_groupCombo->currentText()); - m_settings.toSettings(m_settingsPrefix, Core::ICore::settings()); + m_lastUsedSnippetGroup = m_groupCombo->currentText(); + Core::ICore::settings()->setValue(kLastUsedSnippetGroup, m_lastUsedSnippetGroup); } bool SnippetsSettingsWidget::settingsChanged() const { - if (m_settings.lastUsedSnippetGroup() != m_groupCombo->currentText()) - return true; - return false; + return m_lastUsedSnippetGroup != m_groupCombo->currentText(); } void SnippetsSettingsWidget::loadSnippetGroup(int index) diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs index 7c0ee120934..ccb298a5aa8 100644 --- a/src/plugins/texteditor/texteditor.qbs +++ b/src/plugins/texteditor/texteditor.qbs @@ -222,8 +222,6 @@ QtcPlugin { "snippetprovider.h", "snippetscollection.cpp", "snippetscollection.h", - "snippetssettings.cpp", - "snippetssettings.h", "snippetssettingspage.cpp", "snippetssettingspage.h", ] From a05b0a78297040384bf9c0c1a8773fdd9d800589 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 4 Jun 2024 11:20:53 +0200 Subject: [PATCH 02/45] LayoutBuilder: Potentially save a few cycles ... by not actually creating the unused instances of the Id types. Change-Id: Id6123d359d8b8af41794e41a61fc00b05a2291ed Reviewed-by: Marcus Tillmanns --- src/libs/utils/layoutbuilder.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libs/utils/layoutbuilder.h b/src/libs/utils/layoutbuilder.h index eb516cecc88..c62623f2769 100644 --- a/src/libs/utils/layoutbuilder.h +++ b/src/libs/utils/layoutbuilder.h @@ -41,13 +41,12 @@ namespace Layouting { class NestId {}; -template +template class IdAndArg { public: - IdAndArg(const T1 &id, const T2 &arg) : id(id), arg(arg) {} - const T1 id; - const T2 arg; // FIXME: Could be const &, but this would currently break bindTo(). + IdAndArg(Id, const Arg &arg) : arg(arg) {} + const Arg arg; // FIXME: Could be const &, but this would currently break bindTo(). }; template @@ -107,7 +106,7 @@ public: template BuilderItem(IdAndArg && idarg) { - apply = [&idarg](X *x) { doit(x, idarg.id, idarg.arg); }; + apply = [&idarg](X *x) { doit(x, Id{}, idarg.arg); }; } std::function apply; From f64232f77b472cf5bb9ea3b8538c3f05338caa13 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 5 Jun 2024 17:27:14 +0200 Subject: [PATCH 03/45] Fix some random deprecation warning if QT_DEPRECATED_SINCE(6, 0) QT_DEPRECATED_VERSION_X_6_0("Use position().toPoint()") inline QPoint pos() const { return position().toPoint(); } ... Change-Id: If885b26c8e5f4d68ca1c5c7e4ffc495b0701b210 Reviewed-by: Christian Stenger --- src/libs/advanceddockingsystem/workspaceview.cpp | 2 +- src/libs/extensionsystem/invoker.h | 2 +- .../modelinglib/qmt/diagram_widgets_ui/diagramview.cpp | 6 +++--- .../modelinglib/qmt/model_widgets_ui/modeltreeview.cpp | 4 ++-- src/libs/utils/dropsupport.cpp | 4 ++-- src/plugins/designer/formeditor.cpp | 2 +- .../components/listmodeleditor/listmodeleditormodel.cpp | 2 +- .../components/texteditor/texteditorwidget.cpp | 4 ++-- .../qmldesigner/designercore/model/propertyparser.cpp | 7 +++---- src/plugins/scxmleditor/common/graphicsview.cpp | 8 ++++---- src/plugins/texteditor/texteditor.cpp | 4 ++-- 11 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/libs/advanceddockingsystem/workspaceview.cpp b/src/libs/advanceddockingsystem/workspaceview.cpp index 26983c2bcd7..116ad95670c 100644 --- a/src/libs/advanceddockingsystem/workspaceview.cpp +++ b/src/libs/advanceddockingsystem/workspaceview.cpp @@ -289,7 +289,7 @@ void WorkspaceView::keyPressEvent(QKeyEvent *event) void WorkspaceView::dropEvent(QDropEvent *event) { - const QModelIndex dropIndex = indexAt(event->pos()); + const QModelIndex dropIndex = indexAt(event->position().toPoint()); const DropIndicatorPosition dropIndicator = dropIndicatorPosition(); const auto droppedWorkspaces = selectedWorkspaces(); diff --git a/src/libs/extensionsystem/invoker.h b/src/libs/extensionsystem/invoker.h index 8cd27eb1759..ada8aa7cf51 100644 --- a/src/libs/extensionsystem/invoker.h +++ b/src/libs/extensionsystem/invoker.h @@ -38,7 +38,7 @@ private: InvokerBase(const InvokerBase &); // Unimplemented. template const char *typeName() { - return QMetaType::typeName(qMetaTypeId()); + return QMetaType(qMetaTypeId()).name(); } QObject *target; QGenericArgument arg[10]; diff --git a/src/libs/modelinglib/qmt/diagram_widgets_ui/diagramview.cpp b/src/libs/modelinglib/qmt/diagram_widgets_ui/diagramview.cpp index eba246676d1..555dc812e62 100644 --- a/src/libs/modelinglib/qmt/diagram_widgets_ui/diagramview.cpp +++ b/src/libs/modelinglib/qmt/diagram_widgets_ui/diagramview.cpp @@ -112,7 +112,7 @@ void DiagramView::dropEvent(QDropEvent *event) if (diagramSceneController->isAddingAllowed(Uid(QUuid(key)), m_diagramSceneModel->diagram())) { diagramSceneController->addExistingModelElement(Uid(QUuid(key)), - mapToScene(event->pos()), + mapToScene(event->position().toPoint()), m_diagramSceneModel->diagram()); } } @@ -126,10 +126,10 @@ void DiagramView::dropEvent(QDropEvent *event) QString stereotype; dataStream >> newElementId >> name >> stereotype; if (!newElementId.isEmpty()) { - QPointF pos = mapToScene(event->pos()); + QPointF pos = mapToScene(event->position().toPoint()); diagramSceneController->dropNewElement( newElementId, name, stereotype, m_diagramSceneModel->findTopmostElement(pos), - pos, m_diagramSceneModel->diagram(), event->pos(), size()); + pos, m_diagramSceneModel->diagram(), event->position().toPoint(), size()); } } event->accept(); diff --git a/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp b/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp index 875b1fa1058..e2006a37b5d 100644 --- a/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp +++ b/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp @@ -184,7 +184,7 @@ void ModelTreeView::dragMoveEvent(QDragMoveEvent *event) { QTreeView::dragMoveEvent(event); bool accept = false; - QModelIndex dropIndex = indexAt(event->pos()); + QModelIndex dropIndex = indexAt(event->position().toPoint()); QModelIndex dropSourceModelIndex = m_sortedTreeModel->mapToSource(dropIndex); if (dropSourceModelIndex.isValid()) { TreeModel *treeModel = m_sortedTreeModel->treeModel(); @@ -215,7 +215,7 @@ void ModelTreeView::dropEvent(QDropEvent *event) bool accept = false; event->setDropAction(Qt::MoveAction); if (event->mimeData()->hasFormat("text/model-elements")) { - QModelIndex dropIndex = indexAt(event->pos()); + QModelIndex dropIndex = indexAt(event->position().toPoint()); QModelIndex dropSourceModelIndex = m_sortedTreeModel->mapToSource(dropIndex); if (dropSourceModelIndex.isValid()) { TreeModel *treeModel = m_sortedTreeModel->treeModel(); diff --git a/src/libs/utils/dropsupport.cpp b/src/libs/utils/dropsupport.cpp index 7416edf9c37..4ed12456438 100644 --- a/src/libs/utils/dropsupport.cpp +++ b/src/libs/utils/dropsupport.cpp @@ -108,7 +108,7 @@ bool DropSupport::eventFilter(QObject *obj, QEvent *event) de->acceptProposedAction(); bool needToScheduleEmit = m_files.isEmpty(); m_files.append(tempFiles); - m_dropPos = de->pos(); + m_dropPos = de->position().toPoint(); if (needToScheduleEmit) { // otherwise we already have a timer pending // Delay the actual drop, to avoid conflict between // actions that happen when opening files, and actions that the item views do @@ -122,7 +122,7 @@ bool DropSupport::eventFilter(QObject *obj, QEvent *event) accepted = true; bool needToScheduleEmit = m_values.isEmpty(); m_values.append(fileDropMimeData->values()); - m_dropPos = de->pos(); + m_dropPos = de->position().toPoint(); if (needToScheduleEmit) QTimer::singleShot(100, this, &DropSupport::emitValuesDropped); } diff --git a/src/plugins/designer/formeditor.cpp b/src/plugins/designer/formeditor.cpp index aaf4a921dde..dd99b4194fb 100644 --- a/src/plugins/designer/formeditor.cpp +++ b/src/plugins/designer/formeditor.cpp @@ -707,7 +707,7 @@ ActionContainer *FormEditorData::createPreviewStyleMenu(QActionGroup *actionGrou QString name = menuId; name += dot; const QVariant data = a->data(); - const bool isDeviceProfile = data.typeId() == QVariant::Int; + const bool isDeviceProfile = data.typeId() == QMetaType::Int; if (isDeviceProfile) { name += deviceProfilePrefix; name += dot; diff --git a/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp b/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp index 6ab97b4307c..f97b6f74acc 100644 --- a/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp +++ b/src/plugins/qmldesigner/components/listmodeleditor/listmodeleditormodel.cpp @@ -29,7 +29,7 @@ public: QVariant maybeConvertToNumber(const QVariant &value) { - if (value.typeId() == QVariant::Bool) + if (value.typeId() == QMetaType::Bool) return value; if (value.typeId() == QMetaType::QString) { diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp index 97ef6c4b689..127780f9181 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp @@ -265,7 +265,7 @@ void TextEditorWidget::dragEnterEvent(QDragEnterEvent *dragEnterEvent) void TextEditorWidget::dragMoveEvent(QDragMoveEvent *dragMoveEvent) { - QTextCursor cursor = m_textEditor->editorWidget()->cursorForPosition(dragMoveEvent->pos()); + QTextCursor cursor = m_textEditor->editorWidget()->cursorForPosition(dragMoveEvent->position().toPoint()); const int cursorPosition = cursor.position(); RewriterView *rewriterView = m_textEditorView->model()->rewriterView(); @@ -279,7 +279,7 @@ void TextEditorWidget::dragMoveEvent(QDragMoveEvent *dragMoveEvent) void TextEditorWidget::dropEvent(QDropEvent *dropEvent) { - QTextCursor cursor = m_textEditor->editorWidget()->cursorForPosition(dropEvent->pos()); + QTextCursor cursor = m_textEditor->editorWidget()->cursorForPosition(dropEvent->position().toPoint()); const int cursorPosition = cursor.position(); RewriterView *rewriterView = m_textEditorView->model()->rewriterView(); diff --git a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp index 788530c291a..264c944feab 100644 --- a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp +++ b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp @@ -201,7 +201,7 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &) QVariant read(const QString &typeStr, const QString &str) { - int type = QMetaType::type(typeStr.toUtf8().constData()); + int type = QMetaType::fromName(typeStr.toUtf8().constData()).id(); if (type == 0) { if (typeStr != "binding"_L1 && typeStr != "enum"_L1) { qWarning() << "Type " << typeStr @@ -270,15 +270,14 @@ QVariant read(int variantType, const QString &str) value = QVariant::fromValue(enumerationFromString(str, &conversionOk)); } else { value = QVariant(str); - value.convert(static_cast(variantType)); + value.convert(QMetaType(variantType)); } break; } } if (!conversionOk) { - qWarning() << "Could not convert" << str - << "to" << QMetaType::typeName(variantType); + qWarning() << "Could not convert" << str << "to" << QMetaType(variantType).name(); value = QVariant(str); } diff --git a/src/plugins/scxmleditor/common/graphicsview.cpp b/src/plugins/scxmleditor/common/graphicsview.cpp index cfb45caf135..cd8bfd4bd17 100644 --- a/src/plugins/scxmleditor/common/graphicsview.cpp +++ b/src/plugins/scxmleditor/common/graphicsview.cpp @@ -175,8 +175,8 @@ void GraphicsView::dragMoveEvent(QDragMoveEvent *event) ScxmlTag *targetTag = nullptr; - QList parentItems = items(event->pos()); - QPointF sceneP = mapToScene(event->pos()); + QList parentItems = items(event->position().toPoint()); + QPointF sceneP = mapToScene(event->position().toPoint()); for (int i = 0; i < parentItems.count(); ++i) { auto item = static_cast(parentItems[i]); if (item && item->type() >= TransitionType && item->containsScenePoint(sceneP)) { @@ -206,9 +206,9 @@ void GraphicsView::dropEvent(QDropEvent *event) int shapeIndex = event->mimeData()->data("shapeIndex").toInt(); ScxmlTag *targetTag = nullptr; - QPointF targetPos = mapToScene(event->pos()); + QPointF targetPos = mapToScene(event->position().toPoint()); - QList parentItems = items(event->pos()); + QList parentItems = items(event->position().toPoint()); for (int i = 0; i < parentItems.count(); ++i) { auto item = static_cast(parentItems[i]); if (item && item->type() >= StateType) { diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 03164abb36b..11e57072152 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -9232,7 +9232,7 @@ void TextEditorWidget::dragLeaveEvent(QDragLeaveEvent *) void TextEditorWidget::dragMoveEvent(QDragMoveEvent *e) { const QRect rect = cursorRect(d->m_dndCursor); - d->m_dndCursor = cursorForPosition(e->pos()); + d->m_dndCursor = cursorForPosition(e->position().toPoint()); if (!rect.isNull()) viewport()->update(rect); viewport()->update(cursorRect(d->m_dndCursor)); @@ -9250,7 +9250,7 @@ void TextEditorWidget::dropEvent(QDropEvent *e) // Update multi text cursor before inserting data MultiTextCursor cursor = multiTextCursor(); cursor.beginEditBlock(); - const QTextCursor eventCursor = cursorForPosition(e->pos()); + const QTextCursor eventCursor = cursorForPosition(e->position().toPoint()); if (e->dropAction() == Qt::MoveAction && e->source() == viewport()) cursor.removeSelectedText(); cursor.setCursors({eventCursor}); From 7e9af008fc4c8753fb6df6d83737f4b1f84f4a6a Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 6 Jun 2024 07:50:39 +0200 Subject: [PATCH 04/45] Lua: Fix Widget size property implementation Change-Id: Ia5d9d8646815257318ad657480167b7f42b9dca9 Reviewed-by: hjk --- src/plugins/lua/bindings/gui.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/lua/bindings/gui.cpp b/src/plugins/lua/bindings/gui.cpp index aaba86f461c..d34848ebc2f 100644 --- a/src/plugins/lua/bindings/gui.cpp +++ b/src/plugins/lua/bindings/gui.cpp @@ -93,10 +93,21 @@ HAS_MEM_FUNC(onClicked, hasOnClicked); HAS_MEM_FUNC(setText, hasSetText); HAS_MEM_FUNC(setTitle, hasSetTitle); HAS_MEM_FUNC(setValue, hasSetValue); +HAS_MEM_FUNC(setSize, hasSetSize); template void setProperties(std::unique_ptr &item, const sol::table &children, QObject *guard) { + if constexpr (hasSetSize::value) { + sol::optional size = children.get>("size"); + if (size) { + if (size->size() == 2) + item->setSize(size->get(1), size->get(2)); + else + throw sol::error("size must have exactly two elements"); + } + } + if constexpr (hasOnTextChanged::value) { sol::optional onTextChanged = children.get>("onTextChanged"); @@ -233,8 +244,7 @@ void addGuiModule() gui.new_usertype("Space", sol::call_constructor, sol::constructors()); - gui.new_usertype( - "Stretch", sol::call_constructor, sol::constructors()); + gui.new_usertype("Stretch", sol::call_constructor, sol::constructors()); // Layouts gui.new_usertype( @@ -306,8 +316,6 @@ void addGuiModule() }), "show", &Widget::show, - "setSize", - &Widget::setSize, sol::base_classes, sol::bases()); From 6bfeefbb1b9c69a589aaddbd486195876307531e Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 6 Jun 2024 07:50:58 +0200 Subject: [PATCH 05/45] Lua: Add Gui Demo to lua tests Change-Id: I4b9af6702d425867c5f1f6904d6b939a1cede8e6 Reviewed-by: hjk --- src/plugins/luatests/CMakeLists.txt | 1 + src/plugins/luatests/luatests/guidemo.lua | 23 +++++++++++++++++++++++ src/plugins/luatests/luatests/tests.lua | 13 +++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 src/plugins/luatests/luatests/guidemo.lua diff --git a/src/plugins/luatests/CMakeLists.txt b/src/plugins/luatests/CMakeLists.txt index 80e03b66ca4..0bad7da433b 100644 --- a/src/plugins/luatests/CMakeLists.txt +++ b/src/plugins/luatests/CMakeLists.txt @@ -7,4 +7,5 @@ add_qtc_lua_plugin(luatests luatests/tst_aspectcontainer.lua luatests/tst_fetch.lua luatests/tst_utils.lua + luatests/guidemo.lua ) diff --git a/src/plugins/luatests/luatests/guidemo.lua b/src/plugins/luatests/luatests/guidemo.lua new file mode 100644 index 00000000000..2771529f87a --- /dev/null +++ b/src/plugins/luatests/luatests/guidemo.lua @@ -0,0 +1,23 @@ +-- Copyright (C) 2024 The Qt Company Ltd. +-- SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +local Utils = require("Utils") +local Gui = require("Gui") + +local function using(tbl) + local result = _G + for k, v in pairs(tbl) do result[k] = v end + return result +end + +local function show() + --- "using namespace Gui" + local _ENV = using(Gui) + + Widget { + size = { 400, 300 }, + Row { "Hello World!" }, + }:show() +end + +return show diff --git a/src/plugins/luatests/luatests/tests.lua b/src/plugins/luatests/luatests/tests.lua index fb246ae94de..213aff47ebf 100644 --- a/src/plugins/luatests/luatests/tests.lua +++ b/src/plugins/luatests/luatests/tests.lua @@ -64,6 +64,19 @@ local function setup() text = "Run lua tests", onTrigger = function() a.sync(runTests)() end, }) + Action.create("LuaTests.layoutDemo", { + text = "Lua Layout Demo", + onTrigger = function() + local script, err = loadfile(Utils.FilePath.fromUserInput(script_path()):parentDir():resolvePath( + "guidemo.lua"):nativePath()) + if not script then + print("Failed to load demo:", err) + return + end + + script()() + end, + }) end return { setup = setup } From c8d534cec6e46fa5c13a7d68eb6dec6c5f561fa8 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 5 Jun 2024 18:20:07 +0200 Subject: [PATCH 06/45] RemoteLinux: Add missing reset of "disconnected" state I believe this code path can be taken due to connection sharing. Fixes: QTCREATORBUG-30828 Change-Id: I64a6142574719b85215379e304989f36b6bf46da Reviewed-by: Marcus Tillmanns --- src/plugins/remotelinux/linuxdevice.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index c971c8caa2e..d5aaaad79d0 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -1191,8 +1191,10 @@ void LinuxDevicePrivate::checkOsType() // Call me with shell mutex locked bool LinuxDevicePrivate::setupShell(const SshParameters &sshParameters, bool announce) { - if (m_handler->isRunning(sshParameters)) + if (m_handler->isRunning(sshParameters)) { + setDisconnected(false); return true; + } invalidateEnvironmentCache(); From 21556d992e61a7fd93ff586155c6b6664148e129 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 5 Jun 2024 17:34:16 +0200 Subject: [PATCH 07/45] QmlDesigner: Fix some deprecation warning in FormEditorGraphicsView Change-Id: Ic7c7df7fd357bcb3b7500f2fc9bb5b7cb9661ff9 Reviewed-by: Knud Dollereder --- .../components/formeditor/formeditorgraphicsview.cpp | 7 +++---- .../components/formeditor/formeditorgraphicsview.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp index 4bd0b08c0a1..d835274a97c 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp @@ -3,7 +3,6 @@ #include "formeditorgraphicsview.h" #include "backgroundaction.h" -#include "formeditoritem.h" #include "formeditorwidget.h" #include "navigation2d.h" @@ -76,11 +75,11 @@ bool FormEditorGraphicsView::eventFilter(QObject *watched, QEvent *event) auto mouseEvent = static_cast(event); if (!m_panningStartPosition.isNull()) { horizontalScrollBar()->setValue(horizontalScrollBar()->value() - - (mouseEvent->x() - m_panningStartPosition.x())); + (mouseEvent->position().x() - m_panningStartPosition.x())); verticalScrollBar()->setValue(verticalScrollBar()->value() - - (mouseEvent->y() - m_panningStartPosition.y())); + (mouseEvent->position().y() - m_panningStartPosition.y())); } - m_panningStartPosition = mouseEvent->pos(); + m_panningStartPosition = mouseEvent->position(); event->accept(); return true; } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h index 60e02582cd1..e1e61a8f1e2 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h @@ -46,7 +46,7 @@ private: void stopPanning(QEvent *event); Panning m_isPanning = Panning::NotStarted; - QPoint m_panningStartPosition; + QPointF m_panningStartPosition; QRectF m_rootItemRect; QImage m_backgroundImage; }; From ac86e2328bf5ce698bd70f4be409b0ba8e71f015 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 6 Jun 2024 08:12:23 +0200 Subject: [PATCH 08/45] Marketplace: Fix layout Only noticeable with network issues. Broke with 903d01b93459d0f1ee70e6ca74a8c01af5e0981b. Change-Id: I85e35c951b4c28b9201362ed17d4dae529ccb041 Reviewed-by: Alessandro Portale --- src/plugins/marketplace/qtmarketplacewelcomepage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/marketplace/qtmarketplacewelcomepage.cpp b/src/plugins/marketplace/qtmarketplacewelcomepage.cpp index f26a618a10a..954eb55f144 100644 --- a/src/plugins/marketplace/qtmarketplacewelcomepage.cpp +++ b/src/plugins/marketplace/qtmarketplacewelcomepage.cpp @@ -62,6 +62,7 @@ public: Column { Row { m_searcher, + m_errorLabel, customMargins(0, 0, ExVPaddingGapXl, 0), }, m_sectionedProducts, From e2b11b0ed6d7f3eadbc6bf783c4139767d2cb4b9 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 6 Jun 2024 11:38:08 +0200 Subject: [PATCH 09/45] Lua: Add guidemo to luatests for Qbs as well Amends 6bfeefbb1b9c69a589aaddbd486195876307531e. Change-Id: If25b3afca6d52e7f17d5436ed77790449def1dca Reviewed-by: Marcus Tillmanns --- src/plugins/luatests/luatests.qbs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/luatests/luatests.qbs b/src/plugins/luatests/luatests.qbs index d521ed9b71c..687cd6579bd 100644 --- a/src/plugins/luatests/luatests.qbs +++ b/src/plugins/luatests/luatests.qbs @@ -3,6 +3,7 @@ QtcLuaPlugin { luafiles: [ "inspect.lua", + "guidemo.lua", "luatests.lua", "qtctest.lua", "tests.lua", From f058e50ddc48888bda83a67b86285793a654d0d6 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 6 Jun 2024 09:06:45 +0200 Subject: [PATCH 10/45] CppEditor: Work around deprecation in QCryptographicHash Follows de18b3ff370 in qtbase. Change-Id: Ie50b609b5fbe00ee93a536b2d64d73d5bdf0e61e Reviewed-by: Christian Kandeler --- src/plugins/cppeditor/cppsourceprocessor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cppsourceprocessor.cpp b/src/plugins/cppeditor/cppsourceprocessor.cpp index 4cdc6962416..7796c5d2ab1 100644 --- a/src/plugins/cppeditor/cppsourceprocessor.cpp +++ b/src/plugins/cppeditor/cppsourceprocessor.cpp @@ -56,11 +56,11 @@ inline QByteArray generateFingerPrint(const QList &definedMacr } else { static const QByteArray def("#define "); hash.addData(macro.name()); - hash.addData(" ", 1); + hash.addData(QByteArrayView(" ", 1)); hash.addData(def); hash.addData(macro.definitionText()); } - hash.addData("\n", 1); + hash.addData(QByteArrayView("\n", 1)); } return hash.result(); } From c3bfcc9b864bb260f225748fd9c9a9d3ab203a3c Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 5 Jun 2024 18:22:41 +0200 Subject: [PATCH 11/45] QmlPuppet: Fix a few more deprecation warnings Change-Id: I4debdccaf6f6c7fcc228eadea6231b58fa8da9d0 Reviewed-by: Knud Dollereder --- .../instances/nodeinstanceclientproxy.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp b/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp index 6ba2fa7fcaa..de07782d1cf 100644 --- a/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp +++ b/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp @@ -131,17 +131,17 @@ void NodeInstanceClientProxy::initializeCapturedStream(const QString &fileName) bool compareCommands(const QVariant &command, const QVariant &controlCommand) { - static const int informationChangedCommandType = QMetaType::type("InformationChangedCommand"); - static const int valuesChangedCommandType = QMetaType::type("ValuesChangedCommand"); - static const int valuesModifiedCommandType = QMetaType::type("ValuesModifiedCommand"); - static const int pixmapChangedCommandType = QMetaType::type("PixmapChangedCommand"); - static const int childrenChangedCommandType = QMetaType::type("ChildrenChangedCommand"); - static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand"); - static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand"); - static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand"); - static const int tokenCommandType = QMetaType::type("TokenCommand"); - static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand"); - static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand"); + static const int informationChangedCommandType = QMetaType::fromName("InformationChangedCommand").id(); + static const int valuesChangedCommandType = QMetaType::fromName("ValuesChangedCommand").id(); + static const int valuesModifiedCommandType = QMetaType::fromName("ValuesModifiedCommand").id(); + static const int pixmapChangedCommandType = QMetaType::fromName("PixmapChangedCommand").id(); + static const int childrenChangedCommandType = QMetaType::fromName("ChildrenChangedCommand").id(); + static const int statePreviewImageChangedCommandType = QMetaType::fromName("StatePreviewImageChangedCommand").id(); + static const int componentCompletedCommandType = QMetaType::fromName("ComponentCompletedCommand").id(); + static const int synchronizeCommandType = QMetaType::fromName("SynchronizeCommand").id(); + static const int tokenCommandType = QMetaType::fromName("TokenCommand").id(); + static const int debugOutputCommandType = QMetaType::fromName("DebugOutputCommand").id(); + static const int changeSelectionCommandType = QMetaType::fromName("ChangeSelectionCommand").id(); if (command.typeId() == controlCommand.typeId()) { if (command.typeId() == informationChangedCommandType) @@ -186,8 +186,8 @@ void NodeInstanceClientProxy::writeCommand(const QVariant &command) } } else if (m_outputIoDevice) { #ifdef NANOTRACE_DESIGNSTUDIO_ENABLED - if (command.typeId() != QMetaType::type("PuppetAliveCommand")) { - if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) { + if (command.typeId() != QMetaType::fromName("PuppetAliveCommand").id()) { + if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) { SyncNanotraceCommand cmd = command.value(); NANOTRACE_INSTANT_ARGS("Sync", "writeCommand", {"name", cmd.name().toStdString()}, From 09fdd9ad9ea974d1444d97bff1330a94f83a6889 Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Thu, 2 May 2024 13:48:28 +0200 Subject: [PATCH 12/45] AppStatisticMonitor: Move build as a separate package Change-Id: I93c9e1e6feb043531f70023ffe6cd74a1d2d95e5 Reviewed-by: Eike Ziller --- .../appstatisticsmonitor/CMakeLists.txt | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/plugins/appstatisticsmonitor/CMakeLists.txt b/src/plugins/appstatisticsmonitor/CMakeLists.txt index 292eb2a3eb2..92ae05962c9 100644 --- a/src/plugins/appstatisticsmonitor/CMakeLists.txt +++ b/src/plugins/appstatisticsmonitor/CMakeLists.txt @@ -1,10 +1,34 @@ +cmake_minimum_required(VERSION 3.16) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake") + +project(AppStatisticMonitor) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + find_package(Qt6 COMPONENTS Charts QUIET) +if (NOT QT_CREATOR_API_DEFINED) + # standalone build + set(DESTINATION DESTINATION .) + include(QtCreatorIDEBranding) + include(QtCreatorAPI) + qtc_handle_compiler_cache_support() + + find_package(QtCreator COMPONENTS Core ProjectExplorer Utils REQUIRED) +endif() + + add_qtc_plugin(AppStatisticsMonitor CONDITION TARGET Qt6::Charts - DEPENDS Qt6::Charts SKIP_TRANSLATION - PLUGIN_DEPENDS Core ProjectExplorer + DEPENDS Qt6::Charts QtCreator::Utils + PLUGIN_DEPENDS QtCreator::Core QtCreator::ProjectExplorer SOURCES appstatisticsmonitorplugin.cpp chart.cpp chart.h From c49ec17d01fd5448fdf59a13b83e3543ddd0a96f Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Mon, 3 Jun 2024 15:55:29 +0200 Subject: [PATCH 13/45] ClangFormat: Allow unknown options in .clang-format file This commit disables syntax checks for the .clang-format file, enabling its use even if it contains errors. Removed pop-up shown when save .clang-format file with errors but left warning when editing it in Code Style Tab. Fixes: QTCREATORBUG-30087 Change-Id: I37a0b1e9d602fcbe4fbbc27f7ab190bcd5c1a1fd Reviewed-by: Christian Kandeler --- .../clangformat/clangformatbaseindenter.cpp | 8 ++----- .../clangformat/clangformatconfigwidget.cpp | 24 ++----------------- .../clangformatglobalconfigwidget.cpp | 4 ++-- src/plugins/clangformat/clangformatutils.cpp | 16 +++++++------ src/plugins/clangformat/clangformatutils.h | 3 ++- 5 files changed, 17 insertions(+), 38 deletions(-) diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp index 295c86fcb6f..ee89619225c 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.cpp +++ b/src/plugins/clangformat/clangformatbaseindenter.cpp @@ -961,12 +961,8 @@ const clang::format::FormatStyle &ClangFormatBaseIndenterPrivate::styleForFile() return m_cachedStyle.style; } - llvm::Expected styleFromProjectFolder - = clang::format::getStyle("file", - m_fileName->toFSPathString().toStdString(), - "none", - "", - &llvmFileSystemAdapter); + llvm::Expected styleFromProjectFolder = clang::format::getStyle( + "file", m_fileName->toFSPathString().toStdString(), "none", "", &llvmFileSystemAdapter, true); if (styleFromProjectFolder && !(*styleFromProjectFolder == clang::format::getNoStyle())) { addQtcStatementMacros(*styleFromProjectFolder); diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp index ec1afdcfc1f..418769cbf12 100644 --- a/src/plugins/clangformat/clangformatconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatconfigwidget.cpp @@ -326,28 +326,8 @@ void ClangFormatConfigWidget::apply() if (!m_editorWidget->isEnabled()) return; - clang::format::FormatStyle currentSettingsStyle; - const Utils::expected_str success - = parseConfigurationContent(m_editor->document()->contents().toStdString(), - currentSettingsStyle); - - auto saveSettings = [this] { - QString errorString; - m_editor->document()->save(&errorString, m_config->filePath()); - }; - - if (success) { - saveSettings(); - return; - } - - QMessageBox mBox; - mBox.setText(Tr::tr("The current ClangFormat (C++ > Code Style > ClangFormat) settings are not " - "valid. Are you sure you want to apply them?")); - mBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes); - mBox.setDefaultButton(QMessageBox::No); - if (mBox.exec() == QMessageBox::Yes) - saveSettings(); + QString errorString; + m_editor->document()->save(&errorString, m_config->filePath()); } TextEditor::CodeStyleEditorWidget *createClangFormatConfigWidget( diff --git a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp index 27629823426..fdcceea62b4 100644 --- a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp @@ -256,8 +256,8 @@ void ClangFormatGlobalConfigWidget::initCurrentProjectLabel() bool ClangFormatGlobalConfigWidget::projectClangFormatFileExists() { - llvm::Expected styleFromProjectFolder - = clang::format::getStyle("file", m_project->projectFilePath().path().toStdString(), "none"); + llvm::Expected styleFromProjectFolder = clang::format::getStyle( + "file", m_project->projectFilePath().path().toStdString(), "none", "", nullptr, true); return styleFromProjectFolder && !(*styleFromProjectFolder == clang::format::getNoStyle()); } diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp index 6732524f41e..7beb062a45e 100644 --- a/src/plugins/clangformat/clangformatutils.cpp +++ b/src/plugins/clangformat/clangformatutils.cpp @@ -394,7 +394,8 @@ Utils::FilePath filePathToCurrentSettings(const TextEditor::ICodeStylePreference static QString s_errorMessage; Utils::expected_str parseConfigurationContent(const std::string &fileContent, - clang::format::FormatStyle &style) + clang::format::FormatStyle &style, + bool allowUnknownOptions) { auto diagHandler = [](const llvm::SMDiagnostic &diag, void * /*context*/) { s_errorMessage = QString::fromStdString(diag.getMessage().str()) + " " @@ -403,11 +404,12 @@ Utils::expected_str parseConfigurationContent(const std::string &fileConte }; style.Language = clang::format::FormatStyle::LK_Cpp; - const std::error_code error = parseConfiguration(llvm::MemoryBufferRef(fileContent, "YAML"), - &style, - false, - diagHandler, - nullptr); + const std::error_code error = parseConfiguration( + llvm::MemoryBufferRef(fileContent, "YAML"), + &style, + allowUnknownOptions, + diagHandler, + nullptr); if (error) return make_unexpected(s_errorMessage); @@ -418,7 +420,7 @@ Utils::expected_str parseConfigurationFile(const Utils::FilePath &filePath clang::format::FormatStyle &style) { return parseConfigurationContent(filePath.fileContents().value_or(QByteArray()).toStdString(), - style); + style, true); } } // namespace ClangFormat diff --git a/src/plugins/clangformat/clangformatutils.h b/src/plugins/clangformat/clangformatutils.h index 019414b11f5..bea4cdb8cb8 100644 --- a/src/plugins/clangformat/clangformatutils.h +++ b/src/plugins/clangformat/clangformatutils.h @@ -49,7 +49,8 @@ clang::format::FormatStyle currentQtStyle(const TextEditor::ICodeStylePreference Utils::FilePath filePathToCurrentSettings(const TextEditor::ICodeStylePreferences *codeStyle); Utils::expected_str parseConfigurationContent(const std::string &fileContent, - clang::format::FormatStyle &style); + clang::format::FormatStyle &style, + bool allowUnknownOptions = false); Utils::expected_str parseConfigurationFile(const Utils::FilePath &filePath, clang::format::FormatStyle &style); From 451de5adb87b544b27ef241a4689371a4b471954 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 6 Jun 2024 08:10:18 +0200 Subject: [PATCH 14/45] Fix build on older Apple Clang Actually not sooo old. compilationdbparser.cpp:172:34: error: redefinition of 'it' Amends f3e164af4f8e1cd86821fa937233cfbc2b059b3b Change-Id: Ib3fc97b39921138d2a27bbe8f95c504c8823d09f Reviewed-by: Christian Stenger --- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 10 +++++----- .../compilationdbparser.cpp | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 730cdaed4cf..13aee2f2de9 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -84,11 +84,11 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc) // Cache mime check result for speed up if (!isIgnored) { if (auto it = m_mimeBinaryCache.get>( - [mimeType](const QHash &cache) -> std::optional { - auto it = cache.find(mimeType.name()); - if (it != cache.end()) - return *it; - return {}; + [mimeType](const QHash &cache) -> std::optional { + auto cache_it = cache.find(mimeType.name()); + if (cache_it != cache.end()) + return *cache_it; + return {}; })) { isIgnored = *it; } else { diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp index d613c81faf5..97ed389bc2b 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp @@ -169,9 +169,9 @@ void CompilationDbParser::start() if (!isIgnored) { if (auto it = m_mimeBinaryCache.get>( [mimeType](const QHash &cache) -> std::optional { - auto it = cache.find(mimeType.name()); - if (it != cache.end()) - return *it; + const auto cache_it = cache.find(mimeType.name()); + if (cache_it != cache.end()) + return *cache_it; return {}; })) { isIgnored = *it; From 2006ab3d230b88f2759b72c201fa977db006d9a4 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 5 Jun 2024 14:23:02 +0200 Subject: [PATCH 15/45] CompilationDBPM: Prefer kit toolchain If there was no exact match of the compiler executable in the JSON database with one of our toolchains, we used to use a random toolchain that was of the same basic type as the compiler given in the JSON file, with no regards to target ABI etc. Instead, we now use the kit toolchain in that case if it has a matching type, as that one is assumed to be the user's preference. Fixes: QTCREATORBUG-31001 Change-Id: I2c69a7fb328a034fdf097d306f9673a245bf4772 Reviewed-by: Christian Stenger --- .../compilationdatabaseproject.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index af22b135203..c7118690871 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -106,8 +106,10 @@ QString compilerPath(QString pathFlag) Toolchain *toolchainFromFlags(const Kit *kit, const QStringList &flags, const Utils::Id &language) { + Toolchain * const kitToolchain = ToolchainKitAspect::toolchain(kit, language); + if (flags.empty()) - return ToolchainKitAspect::toolchain(kit, language); + return kitToolchain; // Try exact compiler match. const Utils::FilePath compiler = Utils::FilePath::fromUserInput(compilerPath(flags.front())); @@ -118,6 +120,8 @@ Toolchain *toolchainFromFlags(const Kit *kit, const QStringList &flags, const Ut return toolchain; Utils::Id compilerId = getCompilerId(compiler.fileName()); + if (kitToolchain->isValid() && kitToolchain->typeId() == compilerId) + return kitToolchain; if ((toolchain = toolchainFromCompilerId(compilerId, language))) return toolchain; @@ -126,13 +130,14 @@ Toolchain *toolchainFromFlags(const Kit *kit, const QStringList &flags, const Ut compilerId = Utils::HostOsInfo::isWindowsHost() ? ProjectExplorer::Constants::CLANG_CL_TOOLCHAIN_TYPEID : ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID; + if (kitToolchain->isValid() && kitToolchain->typeId() == compilerId) + return kitToolchain; if ((toolchain = toolchainFromCompilerId(compilerId, language))) return toolchain; } - toolchain = ToolchainKitAspect::toolchain(kit, language); qWarning() << "No matching toolchain found, use the default."; - return toolchain; + return kitToolchain; } void addDriverModeFlagIfNeeded(const Toolchain *toolchain, From cb0bedc49df76685741b0299914294526ee19e47 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Jun 2024 08:41:26 +0200 Subject: [PATCH 16/45] QbsProjectManager: Work around some warnings Deprecations and unused includes. Change-Id: I555db9d7894d3942711ae64d1b30edaf96b96ca3 Reviewed-by: Christian Stenger --- src/plugins/qbsprojectmanager/qbsprofilemanager.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp b/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp index 01dd5efb4fe..4968d3d2163 100644 --- a/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp +++ b/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp @@ -4,9 +4,6 @@ #include "qbsprofilemanager.h" #include "defaultpropertyprovider.h" -#include "qbsproject.h" -#include "qbsprojectmanagerconstants.h" -#include "qbsprojectmanagerplugin.h" #include "qbsprojectmanagertr.h" #include "qbssettings.h" @@ -82,9 +79,9 @@ QString toJSLiteral(const QVariant &val) str += '}'; return str; } - if (val.typeId() == QVariant::Bool) + if (val.typeId() == QMetaType::Bool) return toJSLiteral(val.toBool()); - if (val.canConvert(QMetaType::QString)) + if (val.canConvert(QMetaType(QMetaType::QString))) return toJSLiteral(val.toString()); return QString::fromLatin1("Unconvertible type %1").arg(QLatin1String(val.typeName())); } From 88ee3aa90840e9c4fa13e79a29bbe9dba50d782b Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 7 Jun 2024 10:28:21 +0200 Subject: [PATCH 17/45] TaskTree: Qt-ify the code (part 2) 6. Drop #pragma once header guides. 7. Remove trailing semicolons after Q_ENUM_NS. 8. Use QT_CONFIG(process) for QProcessTask. 9. Update copyright headers. 10. Enclose all classes into Qt namespace. Amends 6621c68ca970c6760fbf10deae0a175202c6a8e1 Change-Id: I42df9a04b029a65d025699eb02fd9f3d1c1a333a Reviewed-by: hjk --- src/libs/solutions/tasking/barrier.cpp | 7 ++++++- src/libs/solutions/tasking/barrier.h | 12 +++++++++-- src/libs/solutions/tasking/concurrentcall.h | 12 +++++++++-- src/libs/solutions/tasking/networkquery.cpp | 7 ++++++- src/libs/solutions/tasking/networkquery.h | 11 +++++++--- src/libs/solutions/tasking/qprocesstask.cpp | 16 +++++++++++++- src/libs/solutions/tasking/qprocesstask.h | 16 ++++++++++++-- src/libs/solutions/tasking/tasking_global.h | 11 ++++++++-- src/libs/solutions/tasking/tasktree.cpp | 7 ++++++- src/libs/solutions/tasking/tasktree.h | 21 ++++++++++++------- src/libs/solutions/tasking/tasktreerunner.cpp | 5 +++++ src/libs/solutions/tasking/tasktreerunner.h | 10 ++++++++- 12 files changed, 111 insertions(+), 24 deletions(-) diff --git a/src/libs/solutions/tasking/barrier.cpp b/src/libs/solutions/tasking/barrier.cpp index 74c11f50de5..650aae3403b 100644 --- a/src/libs/solutions/tasking/barrier.cpp +++ b/src/libs/solutions/tasking/barrier.cpp @@ -1,8 +1,11 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "barrier.h" +QT_BEGIN_NAMESPACE + namespace Tasking { // That's cut down qtcassert.{c,h} to avoid the dependency. @@ -47,3 +50,5 @@ void Barrier::stopWithResult(DoneResult result) } } // namespace Tasking + +QT_END_NAMESPACE diff --git a/src/libs/solutions/tasking/barrier.h b/src/libs/solutions/tasking/barrier.h index 88ef5f9a96e..a484844d38e 100644 --- a/src/libs/solutions/tasking/barrier.h +++ b/src/libs/solutions/tasking/barrier.h @@ -1,12 +1,16 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#pragma once +#ifndef TASKING_BARRIER_H +#define TASKING_BARRIER_H #include "tasking_global.h" #include "tasktree.h" +QT_BEGIN_NAMESPACE + namespace Tasking { class TASKING_EXPORT Barrier final : public QObject @@ -91,3 +95,7 @@ GroupItem waitForBarrierTask(const MultiBarrier &sharedBarrier) } } // namespace Tasking + +QT_END_NAMESPACE + +#endif // TASKING_BARRIER_H diff --git a/src/libs/solutions/tasking/concurrentcall.h b/src/libs/solutions/tasking/concurrentcall.h index a3721fca0cf..ae1fcd17cd5 100644 --- a/src/libs/solutions/tasking/concurrentcall.h +++ b/src/libs/solutions/tasking/concurrentcall.h @@ -1,12 +1,16 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#pragma once +#ifndef TASKING_CONCURRENTCALL_H +#define TASKING_CONCURRENTCALL_H #include "tasktree.h" #include +QT_BEGIN_NAMESPACE + namespace Tasking { // This class introduces the dependency to Qt::Concurrent, otherwise Tasking namespace @@ -98,3 +102,7 @@ template using ConcurrentCallTask = CustomTask>; } // namespace Tasking + +QT_END_NAMESPACE + +#endif // TASKING_CONCURRENTCALL_H diff --git a/src/libs/solutions/tasking/networkquery.cpp b/src/libs/solutions/tasking/networkquery.cpp index c3de4455eb6..30789ec925b 100644 --- a/src/libs/solutions/tasking/networkquery.cpp +++ b/src/libs/solutions/tasking/networkquery.cpp @@ -1,10 +1,13 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "networkquery.h" #include +QT_BEGIN_NAMESPACE + namespace Tasking { void NetworkQuery::start() @@ -51,3 +54,5 @@ NetworkQuery::~NetworkQuery() } } // namespace Tasking + +QT_END_NAMESPACE diff --git a/src/libs/solutions/tasking/networkquery.h b/src/libs/solutions/tasking/networkquery.h index b8ad13bdfae..6d288486712 100644 --- a/src/libs/solutions/tasking/networkquery.h +++ b/src/libs/solutions/tasking/networkquery.h @@ -1,7 +1,9 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -#pragma once +#ifndef TASKING_NETWORKQUERY_H +#define TASKING_NETWORKQUERY_H #include "tasking_global.h" @@ -14,7 +16,6 @@ QT_BEGIN_NAMESPACE class QNetworkAccessManager; -QT_END_NAMESPACE namespace Tasking { @@ -59,3 +60,7 @@ public: using NetworkQueryTask = CustomTask; } // namespace Tasking + +QT_END_NAMESPACE + +#endif // TASKING_NETWORKQUERY_H diff --git a/src/libs/solutions/tasking/qprocesstask.cpp b/src/libs/solutions/tasking/qprocesstask.cpp index 70f9cc2ad8e..b0a61986a38 100644 --- a/src/libs/solutions/tasking/qprocesstask.cpp +++ b/src/libs/solutions/tasking/qprocesstask.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "qprocesstask.h" @@ -10,6 +11,10 @@ #include #include +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(process) + namespace Tasking { class ProcessReaperPrivate; @@ -262,4 +267,13 @@ void QProcessDeleter::operator()(QProcess *process) } // namespace Tasking +#endif // QT_CONFIG(process) + +QT_END_NAMESPACE + +#if QT_CONFIG(process) + #include "qprocesstask.moc" + +#endif // QT_CONFIG(process) + diff --git a/src/libs/solutions/tasking/qprocesstask.h b/src/libs/solutions/tasking/qprocesstask.h index fb71d159aab..3b06e624fb5 100644 --- a/src/libs/solutions/tasking/qprocesstask.h +++ b/src/libs/solutions/tasking/qprocesstask.h @@ -1,7 +1,9 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#pragma once +#ifndef TASKING_QPROCESSTASK_H +#define TASKING_QPROCESSTASK_H #include "tasking_global.h" @@ -9,6 +11,10 @@ #include +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(process) + namespace Tasking { // Deleting a running QProcess may block the caller thread up to 30 seconds and issue warnings. @@ -64,3 +70,9 @@ private: using QProcessTask = CustomTask; } // namespace Tasking + +#endif // QT_CONFIG(process) + +QT_END_NAMESPACE + +#endif // TASKING_QPROCESSTASK_H diff --git a/src/libs/solutions/tasking/tasking_global.h b/src/libs/solutions/tasking/tasking_global.h index 9d9e183b9a3..024d7e33036 100644 --- a/src/libs/solutions/tasking/tasking_global.h +++ b/src/libs/solutions/tasking/tasking_global.h @@ -1,10 +1,13 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#pragma once +#ifndef TASKING_GLOBAL_H +#define TASKING_GLOBAL_H #include +QT_BEGIN_NAMESPACE + #if defined(TASKING_LIBRARY) # define TASKING_EXPORT Q_DECL_EXPORT #elif defined(TASKING_STATIC_LIBRARY) @@ -12,3 +15,7 @@ #else # define TASKING_EXPORT Q_DECL_IMPORT #endif + +QT_END_NAMESPACE + +#endif // TASKING_GLOBAL_H diff --git a/src/libs/solutions/tasking/tasktree.cpp b/src/libs/solutions/tasking/tasktree.cpp index c5a6ed6a70e..2c7a5a8dedb 100644 --- a/src/libs/solutions/tasking/tasktree.cpp +++ b/src/libs/solutions/tasking/tasktree.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "tasktree.h" @@ -19,6 +20,8 @@ using namespace std::chrono; +QT_BEGIN_NAMESPACE + namespace Tasking { // That's cut down qtcassert.{c,h} to avoid the dependency. @@ -3415,3 +3418,5 @@ void TimeoutTaskAdapter::start() */ } // namespace Tasking + +QT_END_NAMESPACE diff --git a/src/libs/solutions/tasking/tasktree.h b/src/libs/solutions/tasking/tasktree.h index 06a3d4ea79c..caedb78c2c8 100644 --- a/src/libs/solutions/tasking/tasktree.h +++ b/src/libs/solutions/tasking/tasktree.h @@ -1,7 +1,9 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 Jarek Kobus +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#pragma once +#ifndef TASKING_TASKTREE_H +#define TASKING_TASKTREE_H #include "tasking_global.h" @@ -13,7 +15,6 @@ QT_BEGIN_NAMESPACE template class QFuture; -QT_END_NAMESPACE namespace Tasking { @@ -41,7 +42,7 @@ enum class WorkflowPolicy FinishAllAndSuccess, // 4 - Reports success after all children finished. FinishAllAndError // 5 - Reports error after all children finished. }; -Q_ENUM_NS(WorkflowPolicy); +Q_ENUM_NS(WorkflowPolicy) enum class SetupResult { @@ -49,14 +50,14 @@ enum class SetupResult StopWithSuccess, StopWithError }; -Q_ENUM_NS(SetupResult); +Q_ENUM_NS(SetupResult) enum class DoneResult { Success, Error }; -Q_ENUM_NS(DoneResult); +Q_ENUM_NS(DoneResult) enum class DoneWith { @@ -64,7 +65,7 @@ enum class DoneWith Error, Cancel }; -Q_ENUM_NS(DoneWith); +Q_ENUM_NS(DoneWith) enum class CallDoneIf { @@ -72,7 +73,7 @@ enum class CallDoneIf Success, Error }; -Q_ENUM_NS(CallDoneIf); +Q_ENUM_NS(CallDoneIf) TASKING_EXPORT DoneResult toDoneResult(bool success); @@ -624,3 +625,7 @@ using TaskTreeTask = CustomTask; using TimeoutTask = CustomTask; } // namespace Tasking + +QT_END_NAMESPACE + +#endif // TASKING_TASKTREE_H diff --git a/src/libs/solutions/tasking/tasktreerunner.cpp b/src/libs/solutions/tasking/tasktreerunner.cpp index 0f7e96db088..d0daa5daaed 100644 --- a/src/libs/solutions/tasking/tasktreerunner.cpp +++ b/src/libs/solutions/tasking/tasktreerunner.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2024 Jarek Kobus // Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 @@ -5,6 +6,8 @@ #include "tasktree.h" +QT_BEGIN_NAMESPACE + namespace Tasking { TaskTreeRunner::~TaskTreeRunner() = default; @@ -38,3 +41,5 @@ void TaskTreeRunner::reset() } } // namespace Tasking + +QT_END_NAMESPACE diff --git a/src/libs/solutions/tasking/tasktreerunner.h b/src/libs/solutions/tasking/tasktreerunner.h index 766ea074f50..ba41c0913fd 100644 --- a/src/libs/solutions/tasking/tasktreerunner.h +++ b/src/libs/solutions/tasking/tasktreerunner.h @@ -1,13 +1,17 @@ +// Copyright (C) 2024 Jarek Kobus // Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#pragma once +#ifndef TASKING_TASKTREERUNNER_H +#define TASKING_TASKTREERUNNER_H #include "tasking_global.h" #include "tasktree.h" #include +QT_BEGIN_NAMESPACE + namespace Tasking { class TASKING_EXPORT TaskTreeRunner : public QObject @@ -42,3 +46,7 @@ private: }; } // namespace Tasking + +QT_END_NAMESPACE + +#endif // TASKING_TASKTREERUNNER_H From 2b4212bfd60f7323b9d42da7a59ffcbf6d5e6735 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Jun 2024 10:44:08 +0200 Subject: [PATCH 18/45] LayoutBuilder: Use explicitly empty cells for nullptr widgets And layouts, and empty label texts. Task-number: QTCREATORBUG-31024 Change-Id: I8435327ddd75d0a218d2a50efe900a7d5ec6490f Reviewed-by: Marcus Tillmanns --- src/libs/utils/layoutbuilder.cpp | 37 ++++++++++++++++---------------- src/libs/utils/layoutbuilder.h | 6 +++--- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/libs/utils/layoutbuilder.cpp b/src/libs/utils/layoutbuilder.cpp index e285ed98f6c..8d087ff495e 100644 --- a/src/libs/utils/layoutbuilder.cpp +++ b/src/libs/utils/layoutbuilder.cpp @@ -232,10 +232,21 @@ LayoutItem::LayoutItem() = default; LayoutItem::~LayoutItem() = default; +LayoutItem::LayoutItem(QLayout *l) + : layout(l), empty(!l) +{} + +LayoutItem::LayoutItem(QWidget *w) + : widget(w), empty(!w) +{} + +LayoutItem::LayoutItem(const QString &t) + : text(t), empty(t.isEmpty()) +{} + LayoutItem::LayoutItem(const LayoutModifier &inner) -{ - ownerModifier = inner; -} + : empty(!inner), ownerModifier(inner) +{} /*! \fn template LayoutItem(const T &t) @@ -428,31 +439,23 @@ void addToWidget(Widget *widget, const Layout &layout) void addToLayout(Layout *layout, const Widget &inner) { - LayoutItem item; - item.widget = access(&inner); - layout->addLayoutItem(item); + layout->addLayoutItem(access(&inner)); } void addToLayout(Layout *layout, QWidget *inner) { - LayoutItem item; - item.widget = inner; - layout->addLayoutItem(item); + layout->addLayoutItem(inner); } void addToLayout(Layout *layout, QLayout *inner) { - LayoutItem item; - item.layout = inner; - layout->addLayoutItem(item); + layout->addLayoutItem(inner); } void addToLayout(Layout *layout, const Layout &inner) { inner.flush_(); - LayoutItem item; - item.layout = access(&inner); - layout->addLayoutItem(item); + layout->addLayoutItem(access(&inner)); } void addToLayout(Layout *layout, const LayoutModifier &inner) @@ -462,9 +465,7 @@ void addToLayout(Layout *layout, const LayoutModifier &inner) void addToLayout(Layout *layout, const QString &inner) { - LayoutItem item; - item.text = inner; - layout->addLayoutItem(item); + layout->addLayoutItem(inner); } void empty(Layout *layout) diff --git a/src/libs/utils/layoutbuilder.h b/src/libs/utils/layoutbuilder.h index c62623f2769..130a4e632dc 100644 --- a/src/libs/utils/layoutbuilder.h +++ b/src/libs/utils/layoutbuilder.h @@ -149,9 +149,9 @@ class QTCREATOR_UTILS_EXPORT LayoutItem public: ~LayoutItem(); LayoutItem(); - LayoutItem(QLayout *l) : layout(l) {} - LayoutItem(QWidget *w) : widget(w) {} - LayoutItem(const QString &t) : text(t) {} + LayoutItem(QLayout *l); + LayoutItem(QWidget *w); + LayoutItem(const QString &t); LayoutItem(const LayoutModifier &inner); QString text; From dc2317ebb876e4fe8840c81659e6fe90fcc5a9be Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Jun 2024 10:54:49 +0200 Subject: [PATCH 19/45] LayoutBuilder: Clean up a bit Change-Id: I584e437f608126b0aceb292e6571ad51fc12fe87 Reviewed-by: Marcus Tillmanns --- src/libs/utils/layoutbuilder.cpp | 4 ---- src/libs/utils/layoutbuilder.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/libs/utils/layoutbuilder.cpp b/src/libs/utils/layoutbuilder.cpp index 8d087ff495e..6f33e4f5ca4 100644 --- a/src/libs/utils/layoutbuilder.cpp +++ b/src/libs/utils/layoutbuilder.cpp @@ -244,10 +244,6 @@ LayoutItem::LayoutItem(const QString &t) : text(t), empty(t.isEmpty()) {} -LayoutItem::LayoutItem(const LayoutModifier &inner) - : empty(!inner), ownerModifier(inner) -{} - /*! \fn template LayoutItem(const T &t) \internal diff --git a/src/libs/utils/layoutbuilder.h b/src/libs/utils/layoutbuilder.h index 130a4e632dc..a411ea47633 100644 --- a/src/libs/utils/layoutbuilder.h +++ b/src/libs/utils/layoutbuilder.h @@ -142,7 +142,6 @@ public: class FlowLayout; class Layout; using LayoutModifier = std::function; -// using LayoutModifier = void(*)(Layout *); class QTCREATOR_UTILS_EXPORT LayoutItem { @@ -152,7 +151,6 @@ public: LayoutItem(QLayout *l); LayoutItem(QWidget *w); LayoutItem(const QString &t); - LayoutItem(const LayoutModifier &inner); QString text; QLayout *layout = nullptr; @@ -161,8 +159,6 @@ public: int spanCols = 1; int spanRows = 1; bool empty = false; - LayoutModifier ownerModifier; - //Qt::Alignment align = {}; }; class QTCREATOR_UTILS_EXPORT Layout : public Object From 73191bce0ce0db76dff29c0ad317a6e908848138 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 6 Jun 2024 14:21:13 +0200 Subject: [PATCH 20/45] Utils: Allow FilePaths to be compared case-sensitively ... and make use of that when renaming. Fixes: QTCREATORBUG-30846 Change-Id: Id06a6df5db13325d17dcd69270604e754d7dee2a Reviewed-by: hjk Reviewed-by: Christian Stenger --- src/libs/utils/filepath.cpp | 27 ++++++++++++++----- src/libs/utils/filepath.h | 4 +++ src/plugins/coreplugin/fileutils.cpp | 2 +- .../projectexplorer/projectexplorer.cpp | 2 +- src/plugins/projectexplorer/projectmodels.cpp | 3 ++- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index c631034eba2..c4d77a29efc 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -293,6 +293,26 @@ QString FilePath::toString() const return scheme() + "://" + encodedHost() + pathView(); } +bool FilePath::equals(const FilePath &first, const FilePath &second, Qt::CaseSensitivity cs) +{ + if (first.m_hash != 0 && second.m_hash != 0 && first.m_hash != second.m_hash) + return false; + + return first.pathView().compare(second.pathView(), cs) == 0 + && first.host() == second.host() + && first.scheme() == second.scheme(); +} + +/*! + * Returns true if the two file paths compare equal case-sensitively. + * This is relevant on semi-case sensitive systems like Windows with NTFS. + * @see QTCREATORBUG-30846 + */ +bool FilePath::equalsCaseSensitive(const FilePath &other) const +{ + return equals(*this, other, Qt::CaseSensitive); +} + /*! Returns a QString for passing on to QString based APIs. @@ -2354,12 +2374,7 @@ DeviceFileHooks &DeviceFileHooks::instance() QTCREATOR_UTILS_EXPORT bool operator==(const FilePath &first, const FilePath &second) { - if (first.m_hash != 0 && second.m_hash != 0 && first.m_hash != second.m_hash) - return false; - - return first.pathView().compare(second.pathView(), first.caseSensitivity()) == 0 - && first.host() == second.host() - && first.scheme() == second.scheme(); + return FilePath::equals(first, second, first.caseSensitivity()); } QTCREATOR_UTILS_EXPORT bool operator!=(const FilePath &first, const FilePath &second) diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h index cb975248ec2..e742bf1a0de 100644 --- a/src/libs/utils/filepath.h +++ b/src/libs/utils/filepath.h @@ -268,6 +268,8 @@ public: // FIXME: Avoid. See toSettings, toVariant, toUserOutput, toFSPathString, path, nativePath. QString toString() const; + bool equalsCaseSensitive(const FilePath &other) const; + private: // These are needed. QTCREATOR_UTILS_EXPORT friend bool operator==(const FilePath &first, const FilePath &second); @@ -282,6 +284,8 @@ private: QTCREATOR_UTILS_EXPORT friend QDebug operator<<(QDebug dbg, const FilePath &c); + static bool equals(const FilePath &first, const FilePath &second, Qt::CaseSensitivity cs); + // Implementation details. May change. friend class ::tst_fileutils; void setPath(QStringView path); diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp index f7c7d4a759c..e05375393da 100644 --- a/src/plugins/coreplugin/fileutils.cpp +++ b/src/plugins/coreplugin/fileutils.cpp @@ -174,7 +174,7 @@ void FileUtils::removeFiles(const FilePaths &filePaths, bool deleteFromFS) bool FileUtils::renameFile(const FilePath &orgFilePath, const FilePath &newFilePath, HandleIncludeGuards handleGuards) { - if (orgFilePath == newFilePath) + if (orgFilePath.equalsCaseSensitive(newFilePath)) return false; const FilePath dir = orgFilePath.absolutePath(); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index b9da6f33a87..d4c5717ce3d 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -3877,7 +3877,7 @@ ProjectExplorerPlugin::renameFile(Node *node, const QString &newFileName) const FilePath newFilePath = FilePath::fromString(newFileName); - if (oldFilePath == newFilePath) + if (oldFilePath.equalsCaseSensitive(newFilePath)) return {}; const HandleIncludeGuards handleGuards = canTryToRenameIncludeGuards(node); diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index 484bc5a0192..5f5aa0150e1 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -291,7 +291,8 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol // The base name of the file was changed. Go look for other files with the same base name // and offer to rename them as well. - if (orgFilePath != newFilePath && orgFilePath.suffix() == newFilePath.suffix()) { + if (!orgFilePath.equalsCaseSensitive(newFilePath) + && orgFilePath.suffix() == newFilePath.suffix()) { const QList candidateNodes = ProjectTree::siblingsWithSameBaseName(node); if (!candidateNodes.isEmpty()) { QStringList fileNames = transform(candidateNodes, [](const Node *n) { From 80f46e055c5d4ca06dffc883cd74f65322f52df0 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Jun 2024 12:10:27 +0200 Subject: [PATCH 21/45] Use non-null valies for LB connection guards Task-number: QTCREATORBUG-31024 Change-Id: I532d2daade968ff4aa2f3dc1ba89d2a3a4e9c2eb Reviewed-by: Marcus Tillmanns --- src/plugins/fakevim/fakevimactions.cpp | 6 +++--- src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp | 2 +- src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp | 4 ++-- src/plugins/vcsbase/commonvcssettings.cpp | 2 +- .../layoutbuilder/tst_manual_widgets_layoutbuilder.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/fakevim/fakevimactions.cpp b/src/plugins/fakevim/fakevimactions.cpp index e6a2a661d52..35cdce0bafb 100644 --- a/src/plugins/fakevim/fakevimactions.cpp +++ b/src/plugins/fakevim/fakevimactions.cpp @@ -199,7 +199,7 @@ FakeVimSettings::FakeVimSettings() autoIndent.setValue(true); smartIndent.setValue(tps.m_autoIndent); incSearch.setValue(true); - }, nullptr), + }, this), }, PushButton { text(Tr::tr("Set Qt Style")), @@ -213,7 +213,7 @@ FakeVimSettings::FakeVimSettings() incSearch.setVolatileValue(true); backspace.setVolatileValue(QString("indent,eol,start")); passKeys.setVolatileValue(true); - }, nullptr), + }, this), }, PushButton { text(Tr::tr("Set Plain Style")), @@ -227,7 +227,7 @@ FakeVimSettings::FakeVimSettings() incSearch.setVolatileValue(false); backspace.setVolatileValue(QString()); passKeys.setVolatileValue(false); - }, nullptr), + }, this), }, st }, diff --git a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp index ad8c5d79950..13e6e09dd31 100644 --- a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp +++ b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp @@ -50,7 +50,7 @@ CustomQbsPropertiesDialog::CustomQbsPropertiesDialog(const QVariantMap &properti Column { PushButton { text(Tr::tr("&Add")), - onClicked([this] { addProperty(); }, nullptr), + onClicked([this] { addProperty(); }, this), }, m_removeButton, st diff --git a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp index 9b25c17d341..34bc379db2a 100644 --- a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp +++ b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp @@ -133,11 +133,11 @@ QbsProfilesSettingsWidget::QbsProfilesSettingsWidget() Column { PushButton { text(Tr::tr("E&xpand All")), - onClicked([this] { m_propertiesView->expandAll(); }, nullptr), + onClicked([this] { m_propertiesView->expandAll(); }, this), }, PushButton { text(Tr::tr("&Collapse All")), - onClicked([this] { m_propertiesView->collapseAll(); }, nullptr), + onClicked([this] { m_propertiesView->collapseAll(); }, this), }, st, }, diff --git a/src/plugins/vcsbase/commonvcssettings.cpp b/src/plugins/vcsbase/commonvcssettings.cpp index 1dbbb130dc5..9bc924c1d4c 100644 --- a/src/plugins/vcsbase/commonvcssettings.cpp +++ b/src/plugins/vcsbase/commonvcssettings.cpp @@ -94,7 +94,7 @@ CommonVcsSettings::CommonVcsSettings() text(Tr::tr("Reset VCS Cache")), Layouting::toolTip(Tr::tr("Reset information about which " "version control system handles which directory.")), - onClicked(&VcsManager::clearVersionControlCache, (QObject *)nullptr) + onClicked(&VcsManager::clearVersionControlCache, this) } } }; diff --git a/tests/manual/widgets/layoutbuilder/tst_manual_widgets_layoutbuilder.cpp b/tests/manual/widgets/layoutbuilder/tst_manual_widgets_layoutbuilder.cpp index eda6a565b1d..772b32ac04a 100644 --- a/tests/manual/widgets/layoutbuilder/tst_manual_widgets_layoutbuilder.cpp +++ b/tests/manual/widgets/layoutbuilder/tst_manual_widgets_layoutbuilder.cpp @@ -24,9 +24,9 @@ int main(int argc, char *argv[]) }; Row { - PushButton { text("-"), onClicked(minusClick, nullptr) }, + PushButton { text("-"), onClicked(minusClick, qApp) }, lineEdit, - PushButton { text("+"), onClicked(plusClick, nullptr) }, + PushButton { text("+"), onClicked(plusClick, qApp) }, Group { title("Splitter in Group"), Column { From cbd596f608d5b7792ef4f87d9b8e9202825a36da Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Jun 2024 13:50:15 +0200 Subject: [PATCH 22/45] ProjectExplorer: Add macro expansion for CopyStep Fixes: QTCREATORBUG-30821 Change-Id: I8cde8d93ca41fa320113d95c25d42f0f277025eb Reviewed-by: Marcus Tillmanns --- src/plugins/projectexplorer/copystep.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/copystep.cpp b/src/plugins/projectexplorer/copystep.cpp index be6c9bb730f..4f9d94e2eeb 100644 --- a/src/plugins/projectexplorer/copystep.cpp +++ b/src/plugins/projectexplorer/copystep.cpp @@ -25,9 +25,11 @@ public: { m_sourceAspect.setSettingsKey(SOURCE_KEY); m_sourceAspect.setLabelText(Tr::tr("Source:")); + m_sourceAspect.setMacroExpanderProvider([this] { return macroExpander(); }); m_targetAspect.setSettingsKey(TARGET_KEY); m_targetAspect.setLabelText(Tr::tr("Target:")); + m_targetAspect.setMacroExpanderProvider([this] { return macroExpander(); }); addMacroExpander(); } @@ -35,8 +37,8 @@ public: protected: bool init() final { - m_source = m_sourceAspect(); - m_target = m_targetAspect(); + m_source = m_sourceAspect.expandedValue(); + m_target = m_targetAspect.expandedValue(); return m_source.exists(); } From 421210e609f865aeaf18e0a6e02c1bf3b4339892 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 6 Jun 2024 13:36:37 +0200 Subject: [PATCH 23/45] Debugger: avoid 32 bit cdb detection Change-Id: I75c8dd4e764b3d16387fb49271bf0b973e0f45b7 Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggeritemmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index b93e0800dec..4d9d663d0d0 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -549,7 +549,7 @@ void DebuggerItemModel::autoDetectCdbDebuggers() for (const QFileInfo &kitFolderFi : kitFolders) { const QString path = kitFolderFi.absoluteFilePath(); - QStringList abis = {"x86", "x64"}; + QStringList abis = {"x64"}; if (HostOsInfo::hostArchitecture() == Utils::OsArchArm64) abis << "arm64"; for (const QString &abi: abis) { From 13c892f9d3ab595518d2348d1772b942a2ec2f68 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Fri, 7 Jun 2024 10:34:55 +0200 Subject: [PATCH 24/45] LuaLSC: Fix crash on exit Since the client lives longer than the lua context, its destruction would also cleanup the custom handlers which had captured the lua function. Calling anything as well as the destructor of a sol object after the lua context is gone results in a crash, so make sure that we don't keep it around any longer. A better solution in the long term would be to allow custom handlers to be unregistered in the Language Client. Change-Id: I59ac39d9279dc5faf24d3fd3b29e8c7c00e2b48e Reviewed-by: David Schulz --- .../lualanguageclient/lualanguageclient.cpp | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp b/src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp index 44fd187a729..67c0cf893a2 100644 --- a/src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp +++ b/src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp @@ -294,8 +294,13 @@ public: } } - // TODO: Unregister Client settings from LanguageClientManager - ~LuaClientWrapper() = default; + ~LuaClientWrapper() + { + for (auto client : m_clients) + LanguageClientManager::shutdownClient(client); + + // TODO: Unregister Client settings from LanguageClientManager + } TransportType transportType() { return m_transportType; } @@ -338,9 +343,15 @@ public: for (Client *c : m_clients) { for (const auto &[msg, func] : m_messageCallbacks.asKeyValueRange()) { c->registerCustomMethod( - msg, [name = msg, f = func](const LanguageServerProtocol::JsonRpcMessage &m) { - auto table = ::Lua::LuaEngine::toTable(f.lua_state(), m.toJsonObject()); - auto result = f.call(table); + msg, + [self = QPointer(this), + name = msg](const LanguageServerProtocol::JsonRpcMessage &m) { + if (!self) + return; + + auto func = self->m_messageCallbacks.value(name); + auto table = ::Lua::LuaEngine::toTable(func.lua_state(), m.toJsonObject()); + auto result = func.call(table); if (!result.valid()) { qWarning() << "Error calling message callback for:" << name << ":" << (result.get().what()); From 685694c7a96750a45eb2f9de44ed352d837c8d63 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Mon, 3 Jun 2024 08:56:52 +0200 Subject: [PATCH 25/45] Copilot: Remove agent.js from the translation agent.js was renamed to language-server.js. This patch changes the installation note but requires a change to the translation files. Change-Id: I02f825260c5a7a3c53fa938c2e074216210493eb Reviewed-by: Eike Ziller --- src/plugins/copilot/copilotsettings.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/plugins/copilot/copilotsettings.cpp b/src/plugins/copilot/copilotsettings.cpp index af16b56db57..81fd4c3b126 100644 --- a/src/plugins/copilot/copilotsettings.cpp +++ b/src/plugins/copilot/copilotsettings.cpp @@ -37,6 +37,8 @@ CopilotSettings &settings() return settings; } +static const QString entryPointFileName = QStringLiteral("language-server.js"); + CopilotSettings::CopilotSettings() { setAutoApply(false); @@ -85,13 +87,16 @@ CopilotSettings::CopilotSettings() distPath.setExpectedKind(PathChooser::File); distPath.setDefaultPathValue(distFromVim); distPath.setSettingsKey("Copilot.DistPath"); - distPath.setLabelText(Tr::tr("Path to agent.js:")); + //: %1 is the filename of the copilot language server + distPath.setLabelText(Tr::tr("Path to %1:").arg(entryPointFileName)); distPath.setHistoryCompleter("Copilot.DistPath.History"); - distPath.setDisplayName(Tr::tr("Agent.js path")); - //: %1 is the URL to copilot.vim getting started - distPath.setToolTip(Tr::tr("Select path to agent.js in Copilot Neovim plugin. See " + //: %1 is the filename of the copilot language server + distPath.setDisplayName(Tr::tr("%1 path").arg(entryPointFileName)); + //: %1 is the URL to copilot.vim getting started, %2 is the filename of the copilot language server + distPath.setToolTip(Tr::tr("Select path to %2 in Copilot Neovim plugin. See " "%1 for installation instructions.") - .arg("https://github.com/github/copilot.vim#getting-started")); + .arg("https://github.com/github/copilot.vim#getting-started") + .arg(entryPointFileName)); autoComplete.setDisplayName(Tr::tr("Auto Request")); autoComplete.setSettingsKey("Copilot.Autocomplete"); @@ -197,12 +202,13 @@ CopilotSettings::CopilotSettings() text(Tr::tr( "The Copilot plugin requires node.js and the Copilot neovim plugin. " "If you install the neovim plugin as described in %1, " - "the plugin will find the agent.js file automatically.\n\n" + "the plugin will find the %3 file automatically.\n\n" "Otherwise you need to specify the path to the %2 " "file from the Copilot neovim plugin.", "Markdown text for the copilot instruction label") .arg("[README.md](https://github.com/github/copilot.vim)") - .arg("[language-server.js](https://github.com/github/copilot.vim/tree/release/dist)")) + .arg("[language-server.js](https://github.com/github/copilot.vim/tree/release/dist)") + .arg(entryPointFileName)), }; return Column { From d308b86847abad84855d8703c6870245ec725d60 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Jun 2024 14:59:00 +0200 Subject: [PATCH 26/45] Utils: Centralize aspect macro expansion setup and handling Let each aspect have a macro expander, and let aspect-owned lineedits use this for expansion. Change-Id: Ifa6f5a678cf81c169643e4145f41e69eafedeb93 Reviewed-by: Marcus Tillmanns --- src/libs/utils/aspects.cpp | 82 ++++++++++--------- src/libs/utils/aspects.h | 12 ++- src/libs/utils/macroexpander.h | 1 - .../cmakebuildconfiguration.cpp | 3 - .../cmakeprojectmanager/cmakeprocess.cpp | 1 + src/plugins/cppeditor/clangdsettings.cpp | 7 +- src/plugins/debugger/commonoptionspage.cpp | 1 - src/plugins/debugger/gdb/gdbsettings.cpp | 2 - .../projectexplorer/buildconfiguration.cpp | 1 - .../buildpropertiessettings.cpp | 1 - src/plugins/projectexplorer/buildstep.cpp | 16 +--- src/plugins/projectexplorer/buildstep.h | 3 - src/plugins/projectexplorer/copystep.cpp | 4 - src/plugins/projectexplorer/processstep.cpp | 2 - .../projectexplorer/projectconfiguration.cpp | 1 + .../projectexplorer/workspaceproject.cpp | 2 - .../remotelinux/customcommanddeploystep.cpp | 2 - 17 files changed, 60 insertions(+), 81 deletions(-) diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp index 13db6a1ecef..e6b8267c4ed 100644 --- a/src/libs/utils/aspects.cpp +++ b/src/libs/utils/aspects.cpp @@ -10,6 +10,7 @@ #include "guard.h" #include "iconbutton.h" #include "layoutbuilder.h" +#include "macroexpander.h" #include "passworddialog.h" #include "pathchooser.h" #include "pathlisteditor.h" @@ -95,6 +96,7 @@ public: BaseAspect::DataCloner m_dataCloner; QList m_dataExtractors; + MacroExpander *m_expander = globalMacroExpander(); QUndoStack *m_undoStack = nullptr; }; @@ -724,6 +726,27 @@ QVariant BaseAspect::fromSettingsValue(const QVariant &val) const return d->m_fromSettings ? d->m_fromSettings(val) : val; } +void BaseAspect::setMacroExpander(MacroExpander *expander) +{ + d->m_expander = expander; +} + +MacroExpander *BaseAspect::macroExpander() const +{ + return d->m_expander; +} + +void BaseAspect::addMacroExpansion(QWidget *w) +{ + if (!d->m_expander) + return; + const auto chooser = new VariableChooser(w); + chooser->addSupportedWidget(w); + chooser->addMacroExpanderProvider([this] { return d->m_expander; }); + if (auto pathChooser = qobject_cast(w)) + pathChooser->setMacroExpander(d->m_expander); +} + namespace Internal { class BoolAspectPrivate @@ -887,7 +910,6 @@ public: Qt::TextElideMode m_elideMode = Qt::ElideNone; QString m_placeHolderText; Key m_historyCompleterKey; - MacroExpanderProvider m_expanderProvider; StringAspect::ValueAcceptor m_valueAcceptor; std::optional m_validator; @@ -1119,16 +1141,6 @@ void StringAspect::setAcceptRichText(bool acceptRichText) emit acceptRichTextChanged(acceptRichText); } -void StringAspect::setMacroExpanderProvider(const MacroExpanderProvider &expanderProvider) -{ - d->m_expanderProvider = expanderProvider; -} - -void StringAspect::setUseGlobalMacroExpander() -{ - d->m_expanderProvider = &globalMacroExpander; -} - void StringAspect::setUseResetButton() { d->m_useResetButton = true; @@ -1149,14 +1161,6 @@ void StringAspect::addToLayout(Layout &parent) { d->m_checkerImpl.addToLayoutFirst(parent); - const auto useMacroExpander = [this](QWidget *w) { - if (!d->m_expanderProvider) - return; - const auto chooser = new VariableChooser(w); - chooser->addSupportedWidget(w); - chooser->addMacroExpanderProvider(d->m_expanderProvider); - }; - const QString displayedString = d->m_displayFilter ? d->m_displayFilter(volatileValue()) : volatileValue(); @@ -1164,6 +1168,7 @@ void StringAspect::addToLayout(Layout &parent) case PasswordLineEditDisplay: case LineEditDisplay: { auto lineEditDisplay = createSubWidget(); + addMacroExpansion(lineEditDisplay); lineEditDisplay->setPlaceholderText(d->m_placeHolderText); if (!d->m_historyCompleterKey.isEmpty()) lineEditDisplay->setHistoryCompleter(d->m_historyCompleterKey); @@ -1197,7 +1202,6 @@ void StringAspect::addToLayout(Layout &parent) } addLabeledItem(parent, lineEditDisplay); - useMacroExpander(lineEditDisplay); if (d->m_useResetButton) { auto resetButton = createSubWidget(Tr::tr("Reset")); resetButton->setEnabled(lineEditDisplay->text() != defaultValue()); @@ -1255,6 +1259,7 @@ void StringAspect::addToLayout(Layout &parent) } case TextEditDisplay: { auto textEditDisplay = createSubWidget(); + addMacroExpansion(textEditDisplay); textEditDisplay->setPlaceholderText(d->m_placeHolderText); textEditDisplay->setUndoRedoEnabled(false); textEditDisplay->setAcceptRichText(d->m_acceptRichText); @@ -1273,7 +1278,6 @@ void StringAspect::addToLayout(Layout &parent) } addLabeledItem(parent, textEditDisplay); - useMacroExpander(textEditDisplay); bufferToGui(); connect(this, &StringAspect::acceptRichTextChanged, @@ -1323,8 +1327,10 @@ void StringAspect::addToLayout(Layout &parent) QString StringAspect::expandedValue() const { - if (!m_internal.isEmpty() && d->m_expanderProvider) - return d->m_expanderProvider()->expand(m_internal); + if (!m_internal.isEmpty()) { + if (auto expander = macroExpander()) + return expander->expand(m_internal); + } return m_internal; } @@ -1406,7 +1412,6 @@ public: PathChooser::Kind m_expectedKind = PathChooser::File; Environment m_environment; QPointer m_pathChooserDisplay; - MacroExpanderProvider m_expanderProvider; FilePath m_baseFileName; StringAspect::ValueAcceptor m_valueAcceptor; std::optional m_validator; @@ -1453,8 +1458,10 @@ FilePath FilePathAspect::operator()() const FilePath FilePathAspect::expandedValue() const { const auto value = TypedAspect::value(); - if (!value.isEmpty() && d->m_expanderProvider) - return FilePath::fromUserInput(d->m_expanderProvider()->expand(value)); + if (!value.isEmpty()) { + if (auto expander = macroExpander()) + return FilePath::fromUserInput(expander->expand(value)); + } return FilePath::fromUserInput(value); } @@ -1586,17 +1593,10 @@ void FilePathAspect::addToLayout(Layouting::Layout &parent) { d->m_checkerImpl.addToLayoutFirst(parent); - const auto useMacroExpander = [this](QWidget *w) { - if (!d->m_expanderProvider) - return; - const auto chooser = new VariableChooser(w); - chooser->addSupportedWidget(w); - chooser->addMacroExpanderProvider(d->m_expanderProvider); - }; - const QString displayedString = d->m_displayFilter ? d->m_displayFilter(value()) : value(); d->m_pathChooserDisplay = createSubWidget(); + addMacroExpansion(d->m_pathChooserDisplay->lineEdit()); d->m_pathChooserDisplay->setExpectedKind(d->m_expectedKind); if (!d->m_historyCompleterKey.isEmpty()) d->m_pathChooserDisplay->setHistoryCompleter(d->m_historyCompleterKey); @@ -1621,7 +1621,6 @@ void FilePathAspect::addToLayout(Layouting::Layout &parent) d->m_pathChooserDisplay->lineEdit()->setPlaceholderText(d->m_placeHolderText); d->m_checkerImpl.updateWidgetFromCheckStatus(this, d->m_pathChooserDisplay.data()); addLabeledItem(parent, d->m_pathChooserDisplay); - useMacroExpander(d->m_pathChooserDisplay->lineEdit()); connect(d->m_pathChooserDisplay, &PathChooser::validChanged, this, &FilePathAspect::validChanged); bufferToGui(); if (isAutoApply() && d->m_autoApplyOnEditingFinished) { @@ -1765,11 +1764,6 @@ void FilePathAspect::setHistoryCompleter(const Key &historyCompleterKey) d->m_pathChooserDisplay->setHistoryCompleter(historyCompleterKey); } -void FilePathAspect::setMacroExpanderProvider(const MacroExpanderProvider &expanderProvider) -{ - d->m_expanderProvider = expanderProvider; -} - void FilePathAspect::validateInput() { if (d->m_pathChooserDisplay) @@ -3237,6 +3231,14 @@ void AspectContainer::setUndoStack(QUndoStack *undoStack) aspect->setUndoStack(undoStack); } +void AspectContainer::setMacroExpander(MacroExpander *expander) +{ + BaseAspect::setMacroExpander(expander); + + for (BaseAspect *aspect : std::as_const(d->m_items)) + aspect->setMacroExpander(expander); +} + bool AspectContainer::equals(const AspectContainer &other) const { // FIXME: Expensive, but should not really be needed in a fully aspectified world. diff --git a/src/libs/utils/aspects.h b/src/libs/utils/aspects.h index 8faeaf7a9e3..60a198c1f7b 100644 --- a/src/libs/utils/aspects.h +++ b/src/libs/utils/aspects.h @@ -7,7 +7,6 @@ #include "guiutils.h" #include "id.h" #include "infolabel.h" -#include "macroexpander.h" #include "pathchooser.h" #include "qtcsettings.h" #include "store.h" @@ -36,6 +35,7 @@ namespace Utils { class AspectContainer; class BoolAspect; class CheckableDecider; +class MacroExpander; namespace Internal { class AspectContainerPrivate; @@ -202,6 +202,9 @@ public: // This is expensive. Do not use without good reason void writeToSettingsImmediatly() const; + void setMacroExpander(MacroExpander *expander); + MacroExpander *macroExpander() const; + signals: void changed(); void volatileValueChanged(); @@ -219,6 +222,8 @@ protected: virtual void handleGuiChanged(); + void addMacroExpansion(QWidget *w); + QLabel *createLabel(); void addLabeledItem(Layouting::Layout &parent, QWidget *widget); @@ -607,8 +612,6 @@ public: void setPlaceHolderText(const QString &placeHolderText); void setHistoryCompleter(const Key &historyCompleterKey); void setAcceptRichText(bool acceptRichText); - void setMacroExpanderProvider(const MacroExpanderProvider &expanderProvider); - void setUseGlobalMacroExpander(); void setUseResetButton(); void setValidationFunction(const FancyLineEdit::ValidationFunction &validator); void setAutoApplyOnEditingFinished(bool applyOnEditingFinished); @@ -685,7 +688,6 @@ public: void setValidationFunction(const FancyLineEdit::ValidationFunction &validator); void setDisplayFilter(const std::function &displayFilter); void setHistoryCompleter(const Key &historyCompleterKey); - void setMacroExpanderProvider(const MacroExpanderProvider &expanderProvider); void setShowToolTipOnLabel(bool show); void setAutoApplyOnEditingFinished(bool applyOnEditingFinished); @@ -975,6 +977,8 @@ public: bool isDirty() override; void setUndoStack(QUndoStack *undoStack) override; + void setMacroExpander(MacroExpander *expander); + template T *aspect() const { for (BaseAspect *aspect : aspects()) diff --git a/src/libs/utils/macroexpander.h b/src/libs/utils/macroexpander.h index adde4db1d3f..fe98d46872f 100644 --- a/src/libs/utils/macroexpander.h +++ b/src/libs/utils/macroexpander.h @@ -5,7 +5,6 @@ #include "utils_global.h" -#include #include #include diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 274ebd8f83f..696ce44c1e2 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -1463,12 +1463,9 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id) buildTypeAspect.setDisplayStyle(StringAspect::LineEditDisplay); buildTypeAspect.setDefaultValue("Unknown"); - initialCMakeArguments.setMacroExpanderProvider([this] { return macroExpander(); }); - additionalCMakeOptions.setSettingsKey("CMake.Additional.Options"); additionalCMakeOptions.setLabelText(Tr::tr("Additional CMake options:")); additionalCMakeOptions.setDisplayStyle(StringAspect::LineEditDisplay); - additionalCMakeOptions.setMacroExpanderProvider([this] { return macroExpander(); }); macroExpander()->registerVariable(DEVELOPMENT_TEAM_FLAG, Tr::tr("The CMake flag for the development team"), diff --git a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp index 618c42892f2..3df6a6bbcb6 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/cppeditor/clangdsettings.cpp b/src/plugins/cppeditor/clangdsettings.cpp index daa78aad7eb..78cce6df1c0 100644 --- a/src/plugins/cppeditor/clangdsettings.cpp +++ b/src/plugins/cppeditor/clangdsettings.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -207,17 +208,17 @@ FilePath ClangdSettings::clangdFilePath() const return fallbackClangdFilePath(); } -FilePath ClangdSettings::projectIndexPath(const Utils::MacroExpander &expander) const +FilePath ClangdSettings::projectIndexPath(const MacroExpander &expander) const { return FilePath::fromUserInput(expander.expand(m_data.projectIndexPathTemplate)); } -FilePath ClangdSettings::sessionIndexPath(const Utils::MacroExpander &expander) const +FilePath ClangdSettings::sessionIndexPath(const MacroExpander &expander) const { return FilePath::fromUserInput(expander.expand(m_data.sessionIndexPathTemplate)); } -bool ClangdSettings::sizeIsOkay(const Utils::FilePath &fp) const +bool ClangdSettings::sizeIsOkay(const FilePath &fp) const { return !sizeThresholdEnabled() || sizeThresholdInKb() * 1024 >= fp.fileSize(); } diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 5739845fe65..b7c56541b82 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -266,7 +266,6 @@ LocalsAndExpressionsSettings::LocalsAndExpressionsSettings() extraDumperCommands.setSettingsKey(debugModeGroup, "GdbCustomDumperCommands"); extraDumperCommands.setDisplayStyle(StringAspect::TextEditDisplay); - extraDumperCommands.setUseGlobalMacroExpander(); extraDumperCommands.setToolTip("

" + Tr::tr("Python commands entered here will be executed after built-in " "debugging helpers have been loaded and fully initialized. You can " diff --git a/src/plugins/debugger/gdb/gdbsettings.cpp b/src/plugins/debugger/gdb/gdbsettings.cpp index e88e9f4f8a9..9ca93263069 100644 --- a/src/plugins/debugger/gdb/gdbsettings.cpp +++ b/src/plugins/debugger/gdb/gdbsettings.cpp @@ -127,7 +127,6 @@ GdbSettings::GdbSettings() gdbStartupCommands.setSettingsKey(debugModeGroup, "GdbStartupCommands"); gdbStartupCommands.setDisplayStyle(StringAspect::TextEditDisplay); - gdbStartupCommands.setUseGlobalMacroExpander(); gdbStartupCommands.setToolTip("

" + Tr::tr( "GDB commands entered here will be executed after " "GDB has been started, but before the debugged program is started or " @@ -136,7 +135,6 @@ GdbSettings::GdbSettings() gdbPostAttachCommands.setSettingsKey(debugModeGroup, "GdbPostAttachCommands"); gdbPostAttachCommands.setDisplayStyle(StringAspect::TextEditDisplay); - gdbPostAttachCommands.setUseGlobalMacroExpander(); gdbPostAttachCommands.setToolTip("

" + Tr::tr( "GDB commands entered here will be executed after " "GDB has successfully attached to remote targets.

" diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index a69133b2190..6cc025d8770 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -194,7 +194,6 @@ BuildConfiguration::BuildConfiguration(Target *target, Utils::Id id) d->m_buildDirectoryAspect.setBaseFileName(target->project()->projectDirectory()); d->m_buildDirectoryAspect.setEnvironment(environment()); - d->m_buildDirectoryAspect.setMacroExpanderProvider([this] { return macroExpander(); }); connect(&d->m_buildDirectoryAspect, &StringAspect::changed, this, &BuildConfiguration::emitBuildDirectoryChanged); connect(this, &BuildConfiguration::environmentChanged, this, [this] { diff --git a/src/plugins/projectexplorer/buildpropertiessettings.cpp b/src/plugins/projectexplorer/buildpropertiessettings.cpp index ff7c1808518..ebfe8782151 100644 --- a/src/plugins/projectexplorer/buildpropertiessettings.cpp +++ b/src/plugins/projectexplorer/buildpropertiessettings.cpp @@ -59,7 +59,6 @@ BuildPropertiesSettings::BuildPropertiesSettings() "The default value can be set using the environment variable " "%1") .arg(Constants::QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE)); - buildDirectoryTemplate.setUseGlobalMacroExpander(); buildDirectoryTemplate.setUseResetButton(); separateDebugInfo.setSettingsKey("ProjectExplorer/Settings/SeparateDebugInfo"); diff --git a/src/plugins/projectexplorer/buildstep.cpp b/src/plugins/projectexplorer/buildstep.cpp index a290fc0c69a..19eb143d245 100644 --- a/src/plugins/projectexplorer/buildstep.cpp +++ b/src/plugins/projectexplorer/buildstep.cpp @@ -85,6 +85,9 @@ BuildStep::BuildStep(BuildStepList *bsl, Id id) : ProjectConfiguration(bsl->target(), id) , m_stepList(bsl) { + if (auto bc = buildConfiguration()) + setMacroExpander(bc->macroExpander()); + connect(this, &ProjectConfiguration::displayNameChanged, this, &BuildStep::updateSummary); } @@ -120,12 +123,8 @@ QWidget *BuildStep::createConfigWidget() form.flush(); } } - auto widget = form.emerge(); - if (m_addMacroExpander) - VariableChooser::addSupportForChildWidgets(widget, macroExpander()); - - return widget; + return form.emerge(); } void BuildStep::fromMap(const Store &map) @@ -196,13 +195,6 @@ BuildConfiguration::BuildType BuildStep::buildType() const return BuildConfiguration::Unknown; } -MacroExpander *BuildStep::macroExpander() const -{ - if (auto bc = buildConfiguration()) - return bc->macroExpander(); - return globalMacroExpander(); -} - QString BuildStep::fallbackWorkingDirectory() const { if (buildConfiguration()) diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index ed07d763e7a..4fd01f0eb33 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -52,7 +52,6 @@ public: BuildSystem *buildSystem() const; BuildConfiguration::BuildType buildType() const; - Utils::MacroExpander *macroExpander() const; enum class OutputFormat { Stdout, Stderr, // These are for forwarded output from external tools @@ -99,7 +98,6 @@ protected: void setWidgetExpandedByDefault(bool widgetExpandedByDefault); void setImmutable(bool immutable) { m_immutable = immutable; } void setSummaryUpdater(const std::function &summaryUpdater); - void addMacroExpander() { m_addMacroExpander = true; } void setSummaryText(const QString &summaryText); DeployConfiguration *deployConfiguration() const; @@ -119,7 +117,6 @@ private: bool m_enabled = true; bool m_immutable = false; bool m_widgetExpandedByDefault = true; - bool m_addMacroExpander = false; std::optional m_wasExpanded; std::function m_summaryUpdater; diff --git a/src/plugins/projectexplorer/copystep.cpp b/src/plugins/projectexplorer/copystep.cpp index 4f9d94e2eeb..812fcb31348 100644 --- a/src/plugins/projectexplorer/copystep.cpp +++ b/src/plugins/projectexplorer/copystep.cpp @@ -25,13 +25,9 @@ public: { m_sourceAspect.setSettingsKey(SOURCE_KEY); m_sourceAspect.setLabelText(Tr::tr("Source:")); - m_sourceAspect.setMacroExpanderProvider([this] { return macroExpander(); }); m_targetAspect.setSettingsKey(TARGET_KEY); m_targetAspect.setLabelText(Tr::tr("Target:")); - m_targetAspect.setMacroExpanderProvider([this] { return macroExpander(); }); - - addMacroExpander(); } protected: diff --git a/src/plugins/projectexplorer/processstep.cpp b/src/plugins/projectexplorer/processstep.cpp index 782eadf91df..18547fcb015 100644 --- a/src/plugins/projectexplorer/processstep.cpp +++ b/src/plugins/projectexplorer/processstep.cpp @@ -60,8 +60,6 @@ public: setupProcessParameters(¶m); return param.summary(display); }); - - addMacroExpander(); } private: diff --git a/src/plugins/projectexplorer/projectconfiguration.cpp b/src/plugins/projectexplorer/projectconfiguration.cpp index 33285507453..423ed95479e 100644 --- a/src/plugins/projectexplorer/projectconfiguration.cpp +++ b/src/plugins/projectexplorer/projectconfiguration.cpp @@ -6,6 +6,7 @@ #include "target.h" #include +#include #include using namespace ProjectExplorer; diff --git a/src/plugins/projectexplorer/workspaceproject.cpp b/src/plugins/projectexplorer/workspaceproject.cpp index 2a22c65c4be..5b0a92ba6c9 100644 --- a/src/plugins/projectexplorer/workspaceproject.cpp +++ b/src/plugins/projectexplorer/workspaceproject.cpp @@ -180,8 +180,6 @@ public: executable.setLabelText(Tr::tr("Executable:")); executable.setReadOnly(true); executable.setValue(bti.targetFilePath); - executable.setMacroExpanderProvider( - [this]() -> MacroExpander * { return const_cast(macroExpander()); }); auto argumentsAsString = [this]() { return CommandLine{ diff --git a/src/plugins/remotelinux/customcommanddeploystep.cpp b/src/plugins/remotelinux/customcommanddeploystep.cpp index 97826fde5e9..2850e59f0cf 100644 --- a/src/plugins/remotelinux/customcommanddeploystep.cpp +++ b/src/plugins/remotelinux/customcommanddeploystep.cpp @@ -31,8 +31,6 @@ public: commandLine.setHistoryCompleter("RemoteLinuxCustomCommandDeploymentStep.History"); setInternalInitializer([this] { return isDeploymentPossible(); }); - - addMacroExpander(); } expected_str isDeploymentPossible() const final; From 2e9e107191ab04898cdc3f8f1da470a4d37ce2b6 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 7 Jun 2024 12:14:50 +0200 Subject: [PATCH 27/45] build.py: Avoid ARM 7z compression filter Which fails to extract with (older?) p7zip from Linux distributions, which is used for building online repositories. Change-Id: Ia9032293841cf192b9b2e0ff820ca4a8b7f47763 Reviewed-by: Patrik Teivonen Reviewed-by: David Schulz --- scripts/build.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/build.py b/scripts/build.py index 66d5d25d43a..094cc9d6c4b 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (C) 2020 The Qt Company Ltd. +# Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 # import the print function which is used in python 3.x @@ -295,12 +295,15 @@ def package_qtcreator(args, paths): '*'], paths.debug_install) if common.is_windows_platform(): - common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads, + # use -mf=off to avoid usage of the ARM executable compression filter, + # which cannot be extracted by the p7zip version on the machine doing + # the repository builds + common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads, '-mf=off', os.path.join(paths.result, 'wininterrupt' + args.zip_infix + '.7z'), '*'], paths.wininterrupt_install) if not args.no_cdb: - common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads, + common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads, '-mf=off', os.path.join(paths.result, 'qtcreatorcdbext' + args.zip_infix + '.7z'), '*'], paths.qtcreatorcdbext_install) From cb1f1bdd61c73ceb1bedea72dd6d08639408bf62 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 16 May 2024 10:10:45 +0200 Subject: [PATCH 28/45] Lua: Wizards Adds a simple lua file wizard, and a lua plugin wizard. Change-Id: I0ea08cdc5eabe7396cb49abd265fce16f5960416 Reviewed-by: David Schulz --- src/plugins/lua/CMakeLists.txt | 1 + src/plugins/lua/wizards/luafile/script.lua | 1 + src/plugins/lua/wizards/luafile/wizard.json | 41 +++++ src/plugins/lua/wizards/plugin/.luarc.json | 9 + src/plugins/lua/wizards/plugin/init.lua.tpl | 7 + src/plugins/lua/wizards/plugin/plugin.lua.tpl | 24 +++ src/plugins/lua/wizards/plugin/project.json | 15 ++ src/plugins/lua/wizards/plugin/wizard.json | 163 ++++++++++++++++++ src/plugins/lua/wizards/wizards.qrc | 11 ++ 9 files changed, 272 insertions(+) create mode 100644 src/plugins/lua/wizards/luafile/script.lua create mode 100644 src/plugins/lua/wizards/luafile/wizard.json create mode 100644 src/plugins/lua/wizards/plugin/.luarc.json create mode 100644 src/plugins/lua/wizards/plugin/init.lua.tpl create mode 100644 src/plugins/lua/wizards/plugin/plugin.lua.tpl create mode 100644 src/plugins/lua/wizards/plugin/project.json create mode 100644 src/plugins/lua/wizards/plugin/wizard.json create mode 100644 src/plugins/lua/wizards/wizards.qrc diff --git a/src/plugins/lua/CMakeLists.txt b/src/plugins/lua/CMakeLists.txt index c7a62e3a8b8..8a3bb96dc11 100644 --- a/src/plugins/lua/CMakeLists.txt +++ b/src/plugins/lua/CMakeLists.txt @@ -4,6 +4,7 @@ add_qtc_plugin(Lua PUBLIC_DEPENDS lua546 sol2 PUBLIC_DEFINES LUA_AVAILABLE SOURCES + wizards/wizards.qrc bindings/action.cpp bindings/async.cpp bindings/core.cpp diff --git a/src/plugins/lua/wizards/luafile/script.lua b/src/plugins/lua/wizards/luafile/script.lua new file mode 100644 index 00000000000..7df869a15e7 --- /dev/null +++ b/src/plugins/lua/wizards/luafile/script.lua @@ -0,0 +1 @@ +print("Hello, World!") diff --git a/src/plugins/lua/wizards/luafile/wizard.json b/src/plugins/lua/wizards/luafile/wizard.json new file mode 100644 index 00000000000..eb1a0863d00 --- /dev/null +++ b/src/plugins/lua/wizards/luafile/wizard.json @@ -0,0 +1,41 @@ +{ + "version": 1, + "supportedProjectTypes": [], + "id": "Q.Lua", + "category": "R.Lua", + "trDescription": "Creates a simple lua file.", + "trDisplayName": "Lua Script", + "trDisplayCategory": "Lua", + "iconText": "ts", + "enabled": "%{JS: value('Plugins').indexOf('Lua') >= 0}", + "options": [ + { + "key": "DefaultSuffix", + "value": "%{JS: Util.preferredSuffix('text/x-lua')}" + } + ], + "pages": [ + { + "trDisplayName": "Location", + "trShortTitle": "Location", + "typeId": "File" + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": [ + { + "typeId": "File", + "data": [ + { + "source": "script.lua", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", + "openInEditor": true + } + ] + } + ] +} diff --git a/src/plugins/lua/wizards/plugin/.luarc.json b/src/plugins/lua/wizards/plugin/.luarc.json new file mode 100644 index 00000000000..00b63f41f20 --- /dev/null +++ b/src/plugins/lua/wizards/plugin/.luarc.json @@ -0,0 +1,9 @@ +{ + "workspace.library": [ + "%{JS: Lua.metaFolder()}" + ], + "hint.paramName": "Literal", + "hint.enable": true, + "hint.await": true, + "hint.arrayIndex": "Disable" +} diff --git a/src/plugins/lua/wizards/plugin/init.lua.tpl b/src/plugins/lua/wizards/plugin/init.lua.tpl new file mode 100644 index 00000000000..2e4203e2c8e --- /dev/null +++ b/src/plugins/lua/wizards/plugin/init.lua.tpl @@ -0,0 +1,7 @@ +local function setup() + print("Hello from Lua!") +end + +return { + setup = setup +} diff --git a/src/plugins/lua/wizards/plugin/plugin.lua.tpl b/src/plugins/lua/wizards/plugin/plugin.lua.tpl new file mode 100644 index 00000000000..9675a2a0051 --- /dev/null +++ b/src/plugins/lua/wizards/plugin/plugin.lua.tpl @@ -0,0 +1,24 @@ +return { + Name = "%{ProjectName}", + Version = "1.0.0", + CompatVersion = "1.0.0", + Vendor = "%{VendorName}", + Copyright = "%{Copyright}", + License = "%{License}", + Category = "My Plugins", + Description = "%{Description}", + Url = "%{Url}", + Experimental = true, + DisabledByDefault = false, + LongDescription = [[ +This plugin provides some functionality. +You can describe it more here. + ]], + Dependencies = { + { Name = "Core", Version = "%{JS: Util.qtCreatorIdeVersion()}", Required = true }, + { Name = "Lua", Version = "%{JS: Util.qtCreatorIdeVersion()}", Required = true }, + }, + setup = function() + require 'init'.setup() + end +} --[[@as QtcPlugin]] diff --git a/src/plugins/lua/wizards/plugin/project.json b/src/plugins/lua/wizards/plugin/project.json new file mode 100644 index 00000000000..f537bf2ea9d --- /dev/null +++ b/src/plugins/lua/wizards/plugin/project.json @@ -0,0 +1,15 @@ +{ + "targets": [ + { + "name": "Qt Creator", + "executable": "%\{IDE:Executable:FilePath\}", + "arguments": [ + "-tcs", + "-load", + "Lua", + "-loadluaplugin", + "%\{ActiveProject:ProjectDirectory\}" + ] + } + ] +} diff --git a/src/plugins/lua/wizards/plugin/wizard.json b/src/plugins/lua/wizards/plugin/wizard.json new file mode 100644 index 00000000000..f854a49a3c1 --- /dev/null +++ b/src/plugins/lua/wizards/plugin/wizard.json @@ -0,0 +1,163 @@ +{ + "version": 1, + "supportedProjectTypes": [ + "Qt4ProjectManager.Qt4Project" + ], + "id": "R.QtCreatorLuaPlugin", + "category": "G.Library", + "trDescription": "Creates a custom Qt Creator Lua plugin.", + "trDisplayName": "Qt Creator Lua Plugin", + "trDisplayCategory": "Library", + "iconText": "LuaP", + "featuresRequired": [ + "QtSupport.Wizards.FeatureQt", + "QtSupport.Wizards.FeatureDesktop" + ], + "enabled": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}", + "options": [ + { + "key": "ProjectFile", + "value": "%{ProjectDirectory}/.qtcreator/project.json" + }, + { + "key": "PluginNameLower", + "value": "%{JS: value('PluginName').toLowerCase()}" + }, + { + "key": "PluginSpecFile", + "value": "%{JS: Util.fileName(value('PluginName').toLowerCase(), Util.preferredSuffix('text/x-lua'))}" + }, + { + "key": "SrcFileName", + "value": "init.lua" + }, + { + "key": "CN", + "value": "%{JS: Cpp.className(value('PluginName') + 'Plugin')}" + }, + { + "key": "HasTranslation", + "value": "%{JS: value('TsFileName') !== ''}" + } + ], + "pages": [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project", + "data": { + "trDescription": "This wizard creates a custom Qt Creator lua plugin." + } + }, + { + "trDisplayName": "Define Project Details", + "trShortTitle": "Details", + "typeId": "Fields", + "data": [ + { + "name": "ClassPageDescription", + "type": "Label", + "data": { + "trText": "Specify details about your custom Qt Creator lua plugin.", + "wordWrap": true + } + }, + { + "name": "PluginName", + "trDisplayName": "Plugin name:", + "mandatory": true, + "type": "LineEdit", + "data": { + "validator": "[a-zA-Z_][a-zA-Z_0-9]*", + "text": "%{JS: value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1)}" + } + }, + { + "name": "VendorName", + "persistenceKey": "VendorName", + "trDisplayName": "Vendor name:", + "mandatory": true, + "type": "LineEdit", + "data": { + "trText": "MyCompany" + } + }, + { + "name": "Copyright", + "trDisplayName": "Copyright:", + "mandatory": true, + "type": "LineEdit", + "data": { + "trText": "(C) %{VendorName}" + } + }, + { + "name": "License", + "trDisplayName": "License:", + "mandatory": true, + "type": "LineEdit", + "data": { + "trText": "Put short license information here" + } + }, + { + "name": "Description", + "trDisplayName": "Description:", + "mandatory": true, + "type": "LineEdit", + "data": { + "trText": "Put a short description of your plugin here" + } + }, + { + "name": "Url", + "persistenceKey": "VendorUrl", + "trDisplayName": "URL:", + "mandatory": true, + "type": "LineEdit", + "data": { + "text": "https://www.%{JS: encodeURIComponent(value('VendorName').toLowerCase())}.com" + } + } + ] + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{JS: !value('IsSubproject')}", + "data": { + "projectFilePath": "%{ProjectFile}" + } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": [ + { + "typeId": "File", + "data": [ + { + "source": "project.json", + "target": "%{ProjectFile}", + "openAsProject": true + }, + { + "source": "init.lua.tpl", + "target": "%{SrcFileName}" + }, + { + "source": ".luarc.json" + }, + { + "source": "plugin.lua.tpl", + "target": "%{PluginSpecFile}", + "openInEditor": true + } + ] + } + ] +} diff --git a/src/plugins/lua/wizards/wizards.qrc b/src/plugins/lua/wizards/wizards.qrc new file mode 100644 index 00000000000..098c2c3f418 --- /dev/null +++ b/src/plugins/lua/wizards/wizards.qrc @@ -0,0 +1,11 @@ + + + luafile/wizard.json + luafile/script.lua + plugin/init.lua.tpl + plugin/plugin.lua.tpl + plugin/project.json + plugin/wizard.json + plugin/.luarc.json + + From 3241818a6a70bcda4da8fc18d7c1e2393264c8ae Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Wed, 24 Apr 2024 12:54:58 +0200 Subject: [PATCH 29/45] AppStatisticMonitor: Add Windows support Change-Id: Ib5b53d7802f54d2a8845ddfc7ba86c977d1db4be Reviewed-by: David Schulz --- .../appstatisticsmonitor/idataprovider.cpp | 93 +++++++++++++------ 1 file changed, 67 insertions(+), 26 deletions(-) diff --git a/src/plugins/appstatisticsmonitor/idataprovider.cpp b/src/plugins/appstatisticsmonitor/idataprovider.cpp index b2026e67cdb..f8cb70fddd6 100644 --- a/src/plugins/appstatisticsmonitor/idataprovider.cpp +++ b/src/plugins/appstatisticsmonitor/idataprovider.cpp @@ -15,6 +15,11 @@ #include #endif +#ifdef Q_OS_WIN +#include +#include +#endif + using namespace Utils; namespace AppStatisticsMonitor::Internal { @@ -175,35 +180,71 @@ class WindowsDataProvider : public IDataProvider public: WindowsDataProvider(qint64 pid, QObject *parent = nullptr) : IDataProvider(pid, parent) - {} - - double getMemoryConsumption() { return 0; } - - double getCpuConsumption() { return 0; } - -#if 0 - double getMemoryConsumptionWindows(qint64 pid) { - HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid); - if (hProcess == NULL) { - std::cerr << "Failed to open process. Error code: " << GetLastError() << std::endl; - return 1; - } + MEMORYSTATUSEX memoryStatus; + memoryStatus.dwLength = sizeof(memoryStatus); + GlobalMemoryStatusEx(&memoryStatus); - PROCESS_MEMORY_COUNTERS_EX pmc; - if (!GetProcessMemoryInfo(hProcess, (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc))) { - std::cerr << "Failed to retrieve process memory information. Error code: " << GetLastError() << std::endl; - CloseHandle(hProcess); - return 1; - } - - std::cout << "Process ID: " << pid << std::endl; - std::cout << "Memory consumption: " << pmc.PrivateUsage << " bytes" << std::endl; - - CloseHandle(hProcess); - return pmc.PrivateUsage; + m_totalMemory = memoryStatus.ullTotalPhys; } -#endif + + double getMemoryConsumption() + { + HANDLE process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, m_pid); + + PROCESS_MEMORY_COUNTERS pmc; + SIZE_T memoryUsed = 0; + if (GetProcessMemoryInfo(process, &pmc, sizeof(pmc))) { + memoryUsed = pmc.WorkingSetSize; + // Can be used in the future for the process lifetime statistics + //double memoryUsedMB = static_cast(memoryUsed) / (1024.0 * 1024.0); + } + + CloseHandle(process); + return static_cast(memoryUsed) / static_cast(m_totalMemory) * 100.0; + } + + double getCpuConsumption() + { + ULARGE_INTEGER sysKernel, sysUser, procKernel, procUser; + HANDLE process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, m_pid); + + FILETIME creationTime, exitTime, kernelTime, userTime; + GetProcessTimes(process, &creationTime, &exitTime, &kernelTime, &userTime); + procKernel.LowPart = kernelTime.dwLowDateTime; + procKernel.HighPart = kernelTime.dwHighDateTime; + procUser.LowPart = userTime.dwLowDateTime; + procUser.HighPart = userTime.dwHighDateTime; + + SYSTEMTIME sysTime; + GetSystemTime(&sysTime); + SystemTimeToFileTime(&sysTime, &kernelTime); + SystemTimeToFileTime(&sysTime, &userTime); + sysKernel.LowPart = kernelTime.dwLowDateTime; + sysKernel.HighPart = kernelTime.dwHighDateTime; + sysUser.LowPart = userTime.dwLowDateTime; + sysUser.HighPart = userTime.dwHighDateTime; + + const double sysElapsedTime = sysKernel.QuadPart + sysUser.QuadPart + - m_lastSysKernel.QuadPart - m_lastSysUser.QuadPart; + const double procElapsedTime = procKernel.QuadPart + procUser.QuadPart + - m_lastProcKernel.QuadPart - m_lastProcUser.QuadPart; + const double cpuUsagePercent = (procElapsedTime / sysElapsedTime) * 100.0; + + m_lastProcKernel = procKernel; + m_lastProcUser = procUser; + m_lastSysKernel = sysKernel; + m_lastSysUser = sysUser; + + CloseHandle(process); + return cpuUsagePercent; + } + +private: + ULARGE_INTEGER m_lastSysKernel = {{0, 0}}, m_lastSysUser = {{0, 0}}, + m_lastProcKernel = {{0, 0}}, m_lastProcUser = {{0, 0}}; + + DWORDLONG m_totalMemory = 0; }; #endif From 29121865a8a3b5ebec3fd75ac82ceed3fbf1843f Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 10 Jun 2024 10:15:02 +0200 Subject: [PATCH 30/45] Session: Add missing include Otherwise Q_DECLARE_TR_FUNCTIONS is not known. Change-Id: I685ccedb7c94847b065ca9919368c74ecc5d2376 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/session.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/session.cpp b/src/plugins/coreplugin/session.cpp index 921046ffed4..4cb088b3ff7 100644 --- a/src/plugins/coreplugin/session.cpp +++ b/src/plugins/coreplugin/session.cpp @@ -30,8 +30,9 @@ #include #include -#include +#include #include +#include #include #include #include From 6141aa3f614cdb2033589bf053fa12503a357618 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 10 Jun 2024 12:24:18 +0200 Subject: [PATCH 31/45] Update qbs submodule to HEAD of 2.4 branch Change-Id: I3c87ea95da4f91f194467249fa8fe55b04d573da Reviewed-by: Christian Stenger --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 1ee1e51fa98..7ca1715dd49 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 1ee1e51fa98f89ae4ee977f6074d070f5788c633 +Subproject commit 7ca1715dd49a33215068e5e701ae4c851d3716e5 From 64ebf36f15118d55672e5222e8bb62da413328d1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 10 Jun 2024 12:31:53 +0200 Subject: [PATCH 32/45] Fix various outdated information in README Change-Id: Ib626b611de25bb437266b8a013622a8f34e28324 Reviewed-by: Christian Kandeler --- README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 7feacabd332..274c5094868 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ include the version number and compiler ABI. The path to the online installer content is not enough. Note that `/path/to/Qt` doesn't imply the full path depth like: -`$USER/Qt/6.2.4/gcc_64/lib/cmake/Qt6`, but only `$USER/Qt/6.2.4/gcc_64`. +`$USER/Qt/6.4.3/gcc_64/lib/cmake/Qt6`, but only `$USER/Qt/6.4.3/gcc_64`. See [instructions](#getting-llvmclang-for-the-clang-code-model) on how to get LLVM. @@ -145,7 +145,7 @@ include the version number and compiler ABI. The path to the online installer content is not enough. Note that `\path\to\Qt` doesn't imply the full path depth like: -`c:\Qt\6.2.4\msvc2019_64\lib\cmake\Qt6`, but only `c:/Qt/6.2.4/msvc2019_64`. +`c:\Qt\6.4.3\msvc2019_64\lib\cmake\Qt6`, but only `c:/Qt/6.4.3/msvc2019_64`. The usage of slashes `/` is intentional, since CMake has issues with backslashes `\` in `CMAKE_PREFX_PATH`, they are interpreted as escape codes. @@ -225,7 +225,7 @@ CLion...etc) locally: "cacheVariables": { "CMAKE_CXX_COMPILER": "cl.exe", "CMAKE_C_COMPILER": "cl.exe", - "CMAKE_PREFIX_PATH": "c:/Qt/6.2.4/msvc2019_64" + "CMAKE_PREFIX_PATH": "c:/Qt/6.4.3/msvc2019_64" } } ] @@ -313,7 +313,7 @@ http://llvm.org/docs/GettingStarted.html#git-mirror: 1. Clone LLVM/Clang and checkout a suitable branch - git clone -b release_130-based --recursive https://code.qt.io/clang/llvm-project.git + git clone -b release_17.0.6-based --recursive https://code.qt.io/clang/llvm-project.git 2. Build and install LLVM/Clang @@ -341,16 +341,6 @@ http://llvm.org/docs/GettingStarted.html#git-mirror: ..\llvm-project\llvm cmake --build . --target install -### Clang-Format - -The ClangFormat plugin depends on the additional patch - - https://code.qt.io/cgit/clang/llvm-project.git/commit/?h=release_130-based&id=42879d1f355fde391ef46b96a659afeb4ad7814a - -While the plugin builds without it, it might not be fully functional. - -Note that the plugin is disabled by default. - # Licenses and Attributions Qt Creator is available under commercial licenses from The Qt Company, From 6e4fbed511d4362f9c64ebee9f7de04fe5088cef Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 10 Jun 2024 14:49:37 +0200 Subject: [PATCH 33/45] RemoteLinux: Serialize the "disconnected" state Otherwise permanently unreachable devices will keep causing annoying delays after every restart. Change-Id: I85c6fd0a6964c7f25e4b61b8eb092fc606b146ad Reviewed-by: Marcus Tillmanns --- src/plugins/remotelinux/linuxdevice.cpp | 15 +++++++++++++++ src/plugins/remotelinux/linuxdevice.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index d5aaaad79d0..8be6a03d03b 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -58,6 +58,8 @@ using namespace Utils; namespace RemoteLinux { +const char DisconnectedKey[] = "Disconnected"; + const QByteArray s_pidMarker = "__qtc"; static Q_LOGGING_CATEGORY(linuxDeviceLog, "qtc.remotelinux.device", QtWarningMsg); @@ -1063,6 +1065,19 @@ LinuxDevice::LinuxDevice() }}); } +void LinuxDevice::fromMap(const Utils::Store &map) +{ + IDevice::fromMap(map); + d->m_disconnected = map.value(DisconnectedKey, false).toBool(); +} + +Store LinuxDevice::toMap() const +{ + Store map = IDevice::toMap(); + map.insert(DisconnectedKey, d->m_disconnected); + return map; +} + void LinuxDevice::_setOsType(Utils::OsType osType) { qCDebug(linuxDeviceLog) << "Setting OS type to" << osType << "for" << displayName(); diff --git a/src/plugins/remotelinux/linuxdevice.h b/src/plugins/remotelinux/linuxdevice.h index 06e0da3f2a8..48c22c52619 100644 --- a/src/plugins/remotelinux/linuxdevice.h +++ b/src/plugins/remotelinux/linuxdevice.h @@ -55,6 +55,9 @@ public: protected: LinuxDevice(); + void fromMap(const Utils::Store &map) override; + Utils::Store toMap() const override; + void _setOsType(Utils::OsType osType); class LinuxDevicePrivate *d; From 37f5501a1f1e6bb0e26e836ba95ad2c65f597742 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 10 Jun 2024 15:03:12 +0200 Subject: [PATCH 34/45] RemoteLinux: Do not try to fetch environment of a disconnected device Change-Id: Ibe1ca43fa3d9d0ade2fa3db1808c1a5fd2cb7232 Reviewed-by: Marcus Tillmanns --- src/plugins/remotelinux/linuxdevice.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 8be6a03d03b..35761285482 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -366,6 +366,9 @@ Environment LinuxDevicePrivate::getEnvironment() if (m_environmentCache.has_value()) return m_environmentCache.value(); + if (m_disconnected) + return {}; + Process getEnvProc; getEnvProc.setCommand(CommandLine{q->filePath("env")}); using namespace std::chrono; From 6040fef26034c0ed0fff41accbff83624e8e2a1c Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 10 Jun 2024 15:14:19 +0200 Subject: [PATCH 35/45] RemoteLinux: Do not try to start a process via a shared connection ... on a disconnected device. Change-Id: Ide89f38783b96d41c50b7f53d649f213522e8857 Reviewed-by: Marcus Tillmanns --- src/plugins/remotelinux/linuxdevice.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 35761285482..d51df10bef4 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -710,6 +710,11 @@ void SshProcessInterfacePrivate::start() this, &SshProcessInterfacePrivate::handleDisconnected); auto linuxDevice = std::dynamic_pointer_cast(m_device); QTC_ASSERT(linuxDevice, handleDone(); return); + if (linuxDevice->isDisconnected()) { + emit q->done({-1, QProcess::CrashExit, QProcess::FailedToStart, + Tr::tr("Device \"%1\" is disconnected").arg(linuxDevice->displayName())}); + return; + } linuxDevice->connectionAccess() ->attachToSharedConnection(m_connectionHandle.get(), m_sshParameters); } else { From acd3d60fb2212c367d769226377e4ba167cc6796 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 6 Jun 2024 14:24:57 +0200 Subject: [PATCH 36/45] Debugger: Add debugger name to progress bar ... when there is more than one engine. Mildly-related-to: QTCREATORBUG-30355 Change-Id: Idaf41b97f51c384ccf6a437d9c9c8dec922affc6 Reviewed-by: Christian Stenger Reviewed-by: Eike Ziller Reviewed-by: hjk --- src/plugins/debugger/debuggerengine.cpp | 6 ++++-- src/plugins/debugger/debuggerruncontrol.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 1aa77ae3ea3..b0ff79f5d1e 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -553,8 +553,10 @@ void DebuggerEnginePrivate::setupViews() = new Perspective(perspectiveId, m_engine->displayName(), parentPerspectiveId, settingsId); m_progress.setProgressRange(0, 1000); - FutureProgress *fp = ProgressManager::addTask(m_progress.future(), - Tr::tr("Launching Debugger"), "Debugger.Launcher"); + const QString msg = m_companionEngines.isEmpty() + ? Tr::tr("Launching Debugger") + : Tr::tr("Launching %1 Debugger").arg(m_debuggerName); + FutureProgress *fp = ProgressManager::addTask(m_progress.future(), msg, "Debugger.Launcher"); connect(fp, &FutureProgress::canceled, m_engine, &DebuggerEngine::quitDebugger); m_progress.reportStarted(); diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 522191e25b3..5688ff191ad 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -543,11 +543,11 @@ void DebuggerRunTool::start() for (auto engine : m_engines) { engine->setRunParameters(m_runParameters); engine->setRunId(d->runId); - engine->setRunTool(this); for (auto companion : m_engines) { if (companion != engine) engine->addCompanionEngine(companion); } + engine->setRunTool(this); if (!first) engine->setSecondaryEngine(); auto rc = runControl(); From 0cd5230f6ab4af830077495eb93b656745f83bee Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 10 Jun 2024 12:25:28 +0200 Subject: [PATCH 37/45] VCS: Improve performance of isVcsFileOrDirectory implementations FilePath operations are relative expensive on Windows compared to the cost of a string comparison, so always first check the file name before checking any file meta data. Change-Id: Ibb4c13d7e11e0c01bdf3706a62362f4c0a27d284 Reviewed-by: Eike Ziller Reviewed-by: Orgad Shaneh --- src/plugins/bazaar/bazaarclient.cpp | 4 ++-- src/plugins/cvs/cvsplugin.cpp | 4 ++-- src/plugins/fossil/fossilclient.cpp | 5 ++--- src/plugins/mercurial/mercurialclient.cpp | 5 +++-- src/plugins/subversion/subversionplugin.cpp | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/bazaar/bazaarclient.cpp b/src/plugins/bazaar/bazaarclient.cpp index 303b7e21c28..77cfd1545cf 100644 --- a/src/plugins/bazaar/bazaarclient.cpp +++ b/src/plugins/bazaar/bazaarclient.cpp @@ -147,8 +147,8 @@ void BazaarClient::annotate(const Utils::FilePath &workingDir, const QString &fi bool BazaarClient::isVcsDirectory(const FilePath &filePath) const { - return filePath.isDir() - && !filePath.fileName().compare(Constants::BAZAARREPO, HostOsInfo::fileNameCaseSensitivity()); + return !filePath.fileName().compare(Constants::BAZAARREPO, HostOsInfo::fileNameCaseSensitivity()) + && filePath.isDir(); } FilePath BazaarClient::findTopLevelForFile(const FilePath &file) const diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 6a25b29fa04..4d6a8e51789 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -333,8 +333,8 @@ Utils::Id CvsPluginPrivate::id() const bool CvsPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &filePath) const { - return filePath.isDir() - && !filePath.fileName().compare("CVS", Utils::HostOsInfo::fileNameCaseSensitivity()); + return !filePath.fileName().compare("CVS", Utils::HostOsInfo::fileNameCaseSensitivity()) + && filePath.isDir(); } bool CvsPluginPrivate::isConfigured() const diff --git a/src/plugins/fossil/fossilclient.cpp b/src/plugins/fossil/fossilclient.cpp index 2c077a3b591..d80dc223cd6 100644 --- a/src/plugins/fossil/fossilclient.cpp +++ b/src/plugins/fossil/fossilclient.cpp @@ -742,9 +742,8 @@ void FossilClient::annotate(const FilePath &workingDir, const QString &file, int bool FossilClient::isVcsFileOrDirectory(const FilePath &filePath) const { // false for any dir or file other than fossil checkout db-file - return filePath.toFileInfo().isFile() - && !filePath.fileName().compare(Constants::FOSSILREPO, - HostOsInfo::fileNameCaseSensitivity()); + return !filePath.fileName().compare(Constants::FOSSILREPO, HostOsInfo::fileNameCaseSensitivity()) + && filePath.isFile(); } FilePath FossilClient::findTopLevelForFile(const FilePath &file) const diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp index 6140706d001..d73d7655738 100644 --- a/src/plugins/mercurial/mercurialclient.cpp +++ b/src/plugins/mercurial/mercurialclient.cpp @@ -347,8 +347,9 @@ void MercurialClient::revertAll(const FilePath &workingDir, const QString &revis bool MercurialClient::isVcsDirectory(const FilePath &filePath) const { - return filePath.isDir() - && !filePath.fileName().compare(Constants::MERCURIALREPO, HostOsInfo::fileNameCaseSensitivity()); + return !filePath.fileName() + .compare(Constants::MERCURIALREPO, HostOsInfo::fileNameCaseSensitivity()) + && filePath.isDir(); } void MercurialClient::view(const FilePath &source, const QString &id, diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 36a5455a629..2339893fcd4 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -477,9 +477,9 @@ SubversionPluginPrivate::SubversionPluginPrivate() bool SubversionPluginPrivate::isVcsDirectory(const FilePath &fileName) const { const QString baseName = fileName.fileName(); - return fileName.isDir() && contains(m_svnDirectories, [baseName](const QString &s) { + return contains(m_svnDirectories, [baseName](const QString &s) { return !baseName.compare(s, HostOsInfo::fileNameCaseSensitivity()); - }); + }) && fileName.isDir(); } bool SubversionPluginPrivate::activateCommit() From f65c54fa3eab8471249d10ed1b583c581f8e29c6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 31 May 2024 08:43:28 +0200 Subject: [PATCH 38/45] Wizards: Remove remaining uses of classToHeaderGuard() Amends 335c552bdafb0966492a675011a696843303af80. Change-Id: I4f43e74f74cd42c4139e91b80abe89bf371411ef Reviewed-by: David Schulz --- .../creator-projects-custom-wizards-json.qdocinc | 2 +- .../wizards/projects/qtquick2-extension/wizard.json | 4 ++-- src/plugins/cppeditor/cpptoolsjsextension.cpp | 5 ----- src/plugins/cppeditor/cpptoolsjsextension.h | 1 - src/plugins/cppeditor/quickfixes/moveclasstoownfile.cpp | 2 +- src/plugins/designer/qtdesignerformclasscodegenerator.cpp | 2 +- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-custom-wizards-json.qdocinc b/doc/qtcreator/src/projects/creator-only/creator-projects-custom-wizards-json.qdocinc index c2d2fe9e2dd..f2d8d254249 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-custom-wizards-json.qdocinc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-custom-wizards-json.qdocinc @@ -238,7 +238,7 @@ { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, { "key": "Base", "value": "%{JS: value('BaseCB') === '' ? value('BaseEdit') : value('BaseCB')}" }, { "key": "isQObject", "value": "%{JS: (value('Base') === 'QObject' || value('Base') === 'QWidget' || value('Base') === 'QMainWindow' || value('Base') === 'QQuickItem' ) ? 'true' : 'false'}" }, - { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName'))}" }, + { "key": "GUARD", "value": "%{JS: Cpp.headerGuard(value('HdrFileName'))}" }, { "key": "SharedDataInit", "value": "%{JS: value('IncludeQSharedData') ? 'data(new %{CN}Data)' : '' }" } ], \endcode diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json b/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json index 0164a9f3d57..d12edc4576d 100644 --- a/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json @@ -23,8 +23,8 @@ { "key": "ObjectHdr", "value": "%{JS: Cpp.classToFileName(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" }, { "key": "ObjectQml", "value": "%{JS: Util.fileName(value('ObjectName') + 'Controls', 'qml')}" }, { "key": "PluginName", "value": "%{JS: value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1) + 'Plugin' }" }, - { "key": "PLUGINGUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('PluginBaseFileName'), Util.preferredSuffix('text/x-c++hdr'))}" }, - { "key": "OBJECTGUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" }, + { "key": "PLUGINGUARD", "value": "%{JS: Cpp.headerGuard(value('PluginHdr'))}" }, + { "key": "OBJECTGUARD", "value": "%{JS: Cpp.headerGuard(value('ObjectHdr'))}" }, { "key": "IsQt6", "value": "%{JS: value('QtVersion').IsQt6}" }, { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, { "key": "QtQuickFeature", "value": "%{JS: (value('QtQuickVersion')=='') ? 'QtSupport.Wizards.FeatureQt.6.2' : 'QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}'}" }, diff --git a/src/plugins/cppeditor/cpptoolsjsextension.cpp b/src/plugins/cppeditor/cpptoolsjsextension.cpp index 607744eec1b..c03a38ede2b 100644 --- a/src/plugins/cppeditor/cpptoolsjsextension.cpp +++ b/src/plugins/cppeditor/cpptoolsjsextension.cpp @@ -98,11 +98,6 @@ QString CppToolsJsExtension::classToFileName(const QString &klass, const QString return finalPath + name + ext; } -QString CppToolsJsExtension::classToHeaderGuard(const QString &klass, const QString &extension) const -{ - return Utils::headerGuard(fileName(className(klass), extension), namespaces(klass)); -} - QString CppToolsJsExtension::openNamespaces(const QString &klass) const { QString result; diff --git a/src/plugins/cppeditor/cpptoolsjsextension.h b/src/plugins/cppeditor/cpptoolsjsextension.h index 593f9536411..3b74ebde703 100644 --- a/src/plugins/cppeditor/cpptoolsjsextension.h +++ b/src/plugins/cppeditor/cpptoolsjsextension.h @@ -39,7 +39,6 @@ public: // Fix the filename casing as configured in C++/File Naming: Q_INVOKABLE QString classToFileName(const QString &klass, const QString &extension) const; - Q_INVOKABLE QString classToHeaderGuard(const QString &klass, const QString &extension) const; Q_INVOKABLE QString openNamespaces(const QString &klass) const; Q_INVOKABLE QString closeNamespaces(const QString &klass) const; Q_INVOKABLE bool hasQObjectParent(const QString &klassName) const; diff --git a/src/plugins/cppeditor/quickfixes/moveclasstoownfile.cpp b/src/plugins/cppeditor/quickfixes/moveclasstoownfile.cpp index e8a6c9b33fe..4b83faaf2d4 100644 --- a/src/plugins/cppeditor/quickfixes/moveclasstoownfile.cpp +++ b/src/plugins/cppeditor/quickfixes/moveclasstoownfile.cpp @@ -388,7 +388,7 @@ private: = Utils::transform(state->namespacePath, [&](const Namespace *ns) { return ov.prettyName(ns->name()); }); - const QString headerGuard = Utils::headerGuard(headerFileName, namespaceNames); + const QString headerGuard = Utils::headerGuard(headerFileName); if (fileSettings.headerPragmaOnce) { headerContent.append("#pragma once\n"); } else { diff --git a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp index 677494658b4..e0afdc45d97 100644 --- a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp +++ b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp @@ -75,7 +75,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete const QString sourceLicense = CppEditor::AbstractEditorSupport::licenseTemplate( project, FilePath::fromString(parameters.sourceFile), parameters.className); // Include guards - const QString guard = Utils::headerGuard(parameters.headerFile, namespaceList); + const QString guard = Utils::headerGuard(parameters.headerFile); const QString uiInclude = "ui_" + QFileInfo(parameters.uiFile).completeBaseName() + ".h"; From 8a6e1d6c06c8700d86efa89425b3746b77126d31 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 6 Jun 2024 14:24:23 +0200 Subject: [PATCH 39/45] TextEditor: Avoid some deprecation warnings Change-Id: I05ceed344086f1cf75926f132422a1e0ae30cf08 Reviewed-by: David Schulz --- src/plugins/texteditor/texteditor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 11e57072152..d75db87a166 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7577,7 +7577,7 @@ bool TextEditorWidget::openLink(const Utils::Link &link, bool inNextSplit) #endif QString url = link.targetFilePath.toString(); - if (url.startsWith(u"https://"_qs) || url.startsWith(u"http://"_qs)) { + if (url.startsWith(u"https://") || url.startsWith(u"http://")) { QDesktopServices::openUrl(url); return true; } @@ -7616,11 +7616,12 @@ void TextEditorWidgetPrivate::requestUpdateLink(QMouseEvent *e) return; // Check that the mouse was actually on the text somewhere - bool onText = q->cursorRect(cursor).right() >= e->x(); + const int posX = e->position().x(); + bool onText = q->cursorRect(cursor).right() >= posX; if (!onText) { QTextCursor nextPos = cursor; nextPos.movePosition(QTextCursor::Right); - onText = q->cursorRect(nextPos).right() >= e->x(); + onText = q->cursorRect(nextPos).right() >= posX; } if (onText) { From 732b503aa2576e805d6f07bbec97909472a6bcfd Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 11 Jun 2024 07:39:21 +0200 Subject: [PATCH 40/45] Lua: Add wizards to qbs build Amends cb1f1bdd61c73ceb1bedea72dd6d08639408bf62. Change-Id: I56a20324a089abc360c94d6eb7d2c2522622a094 Reviewed-by: Marcus Tillmanns --- src/plugins/lua/lua.qbs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/lua/lua.qbs b/src/plugins/lua/lua.qbs index 1b49d94f519..2a539bb0b4d 100644 --- a/src/plugins/lua/lua.qbs +++ b/src/plugins/lua/lua.qbs @@ -21,6 +21,7 @@ QtcPlugin { "luaqttypes.h", "luatr.h", "luauibindings.cpp", + "wizards/wizards.qrc", ] Group { From 3cf9f6479150325a9e8fa257097d3f1b14d54f2f Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Fri, 31 May 2024 14:01:31 +0200 Subject: [PATCH 41/45] Doc: Update info about connecting Linux-based devices - The device wizard instructions should not mention USB, as USB connections are detected automatically - The descriptions in the Extension Manager should use "network" when both wired and wireless connections are supported Change-Id: I29a7279c413b335280fc5f2fa254e8922ecac5a9 Reviewed-by: Eike Ziller --- doc/qtcreator/src/linux-mobile/b2qtdev.qdoc | 10 +++++++--- src/plugins/baremetal/BareMetal.json.in | 2 +- src/plugins/boot2qt/Boot2Qt.json.in | 2 +- src/plugins/qnx/Qnx.json.in | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/qtcreator/src/linux-mobile/b2qtdev.qdoc b/doc/qtcreator/src/linux-mobile/b2qtdev.qdoc index 447f3067d47..04dceb49160 100644 --- a/doc/qtcreator/src/linux-mobile/b2qtdev.qdoc +++ b/doc/qtcreator/src/linux-mobile/b2qtdev.qdoc @@ -100,14 +100,18 @@ \note Enable the \B2Q plugin to use it. - If \QC does not automatically detect a \l{\B2Q: Documentation}{\B2Q} - device you connect with USB: + If \QC does not automatically detect a \B2Q device you connect with USB, + check that you followed the instructions in the \l{\B2Q: Documentation} + {Quick Start Guide} for the device. + + If that does not help, but you can reach the IP address of the device, + create a network connection to it: \list 1 \li Go to \preferences > \uicontrol Devices > \uicontrol Devices. \image qtcreator-boot2qt-device-configurations.webp {Devices tab in Preferences} \li Select \uicontrol Add > \uicontrol {Boot2Qt Device} to create - either a network connection or a USB connection to the device. + a network connection to the device. \image qtcreator-devices-boot2qt.png {Boot to Qt Network Device Setup wizard} \li In \uicontrol {Device name}, enter a name for the connection. \li In \uicontrol {Device address}, enter the host diff --git a/src/plugins/baremetal/BareMetal.json.in b/src/plugins/baremetal/BareMetal.json.in index 805beb7cff6..7499c5a773e 100644 --- a/src/plugins/baremetal/BareMetal.json.in +++ b/src/plugins/baremetal/BareMetal.json.in @@ -17,7 +17,7 @@ "Description" : "Develop applications for bare metal devices", "LongDescription" : [ "Adds a target for bare metal development.", - "Connect devices with USB or WLAN to run, debug, and analyze applications built for them.", + "Connect devices with debug server providers to run, debug, and analyze applications built for them.", "You also need:", "- A toolchain for bare metal development" ], diff --git a/src/plugins/boot2qt/Boot2Qt.json.in b/src/plugins/boot2qt/Boot2Qt.json.in index 9bc2be52d87..c2ece20d50e 100644 --- a/src/plugins/boot2qt/Boot2Qt.json.in +++ b/src/plugins/boot2qt/Boot2Qt.json.in @@ -17,7 +17,7 @@ "Category" : "Device Support", "Description" : "Develop applications for Boot to Qt devices", "LongDescription" : [ - "Connect devices with USB or WLAN to run, debug, and analyze applications built for them.", + "Connect devices with a USB cable, or a wired or wireless connection, depending on the device to run, debug, and analyze applications built for them.", "You also need:", "- Boot to Qt", "- Build tools and other dependencies related to the development host" diff --git a/src/plugins/qnx/Qnx.json.in b/src/plugins/qnx/Qnx.json.in index dc266e0dedc..0cd5d9f251e 100644 --- a/src/plugins/qnx/Qnx.json.in +++ b/src/plugins/qnx/Qnx.json.in @@ -15,7 +15,7 @@ "Category" : "Device Support", "Description" : "Develop for QNX Neutrino devices", "LongDescription" : [ - "Connect devices with USB or WLAN to run, debug, and analyze applications built for them.", + "Connect devices with USB or over a network to run, debug, and analyze applications built for them.", "You also need:", "- Qt for QNX", "- QNX Software Development Platform (SDP)" From bb5b8b40ff676d9e9e23e62a326c5768831fa9fb Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Mon, 10 Jun 2024 14:02:41 +0200 Subject: [PATCH 42/45] LanguageClient: Don't store client settings multiple times Change-Id: Iff6dcfef4d8f1e5cc01b48f2a4cf12f4c5927581 Reviewed-by: David Schulz --- src/plugins/languageclient/languageclientsettings.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/languageclient/languageclientsettings.cpp b/src/plugins/languageclient/languageclientsettings.cpp index 4176918015c..b9db9807174 100644 --- a/src/plugins/languageclient/languageclientsettings.cpp +++ b/src/plugins/languageclient/languageclientsettings.cpp @@ -695,8 +695,10 @@ void LanguageClientSettings::toSettings(QtcSettings *settings, QVariantList typedSettingsVariant; for (const QVariant &var : settings->value(typedClientsKey).toList()) { const Store map = storeFromVariant(var); - Id typeId = Id::fromSetting(map.value(typeIdKey)); - if (typeId.isValid() && !clientTypes().contains(typeId)) + const Id typeId = Id::fromSetting(map.value(typeIdKey)); + const QString id = map.value(idKey).toString(); + if (typeId.isValid() && !clientTypes().contains(typeId) + && !Utils::anyOf(typedSettings, Utils::equal(&BaseSettings::m_id, id))) typedSettingsVariant << var; } From 64f9ff8963f624d845ce371cf9dd3f825dc76a7a Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 6 Jun 2024 10:43:05 +0200 Subject: [PATCH 43/45] Rust: use cached release information Change-Id: Ibc9b0921e02f4c190986bcf69f75a3347369c68d Reviewed-by: Marcus Tillmanns --- src/plugins/rustls/rustls/init.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/rustls/rustls/init.lua b/src/plugins/rustls/rustls/init.lua index 474c368f3a9..fcfd4954fef 100644 --- a/src/plugins/rustls/rustls/init.lua +++ b/src/plugins/rustls/rustls/init.lua @@ -27,12 +27,8 @@ end local function installOrUpdateServer() local data = a.wait(fetch({ - url = "https://api.github.com/repos/rust-lang/rust-analyzer/releases?per_page=2", + url = "https://qtccache.qt.io/RustLanguageServer/LatestReleases", convertToTable = true, - headers = { - Accept = "application/vnd.github.v3+json", - ["X-GitHub-Api-Version"] = "2022-11-28" - } })) if type(data) == "table" and #data > 1 then From 4c2c709256f04c27131dc53ecabcbefb0fe008b6 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 29 May 2024 16:21:19 +0200 Subject: [PATCH 44/45] Doc: Add links to related topics from "Configuring Qt Creator" Edit the style. Change-Id: I3f0404b7d049cfa0e8f6eb530768d31f459ea1fe Reviewed-by: Leena Miettinen Reviewed-by: Eike Ziller --- .../creator-only/creator-configuring.qdoc | 80 +++++++++---------- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc b/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc index c612eb8642b..b2ea02c1280 100644 --- a/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc +++ b/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc @@ -22,10 +22,10 @@ Qt versions and compilers by adding the paths to them and by creating \l{glossary-buildandrun-kit}{kits} that use them. - To make \QC behave more like your favorite code editor or IDE, you can - change the settings for keyboard shortcuts, color schemes, generic - highlighting, code snippets, and version control systems. In addition, - you can enable and disable \QC features by managing plugins. + To make \QC behave more like your favorite code editor or IDE, + change the preferences for keyboard shortcuts, color schemes, generic + highlighting, code snippets, and version control systems. Manage plugins + to turn on and off \QC features. The following sections summarize the options that you have and point you to detailed information to help you specify any required settings and to make @@ -33,8 +33,8 @@ \section1 Checking Build and Run Settings - \QC is an integrated development environment (IDE) that you can use to - develop Qt applications. While you can use \QOI to install \QC, + \QC is an integrated development environment (IDE) for creating + applications. While you can use \QOI to install \QC, the stand-alone \QC installer never installs Qt or any Qt tools, such as qmake. To use \QC for Qt development, you also need to install a Qt version and a compiler. If you update the compiler version later, you @@ -45,9 +45,7 @@ available in \QC. If it does not, you must add the kits yourself to tell \QC where everything is. - To add kits, select \preferences > \uicontrol Kits > \uicontrol Add. - - For more information, see \l{Add kits}. + To add kits, go to \preferences > \uicontrol Kits and select \uicontrol Add. Each kit consists of a set of values that define one environment, such as a \l{glossary-device}{device}, compiler, and Qt version. If \preferences > @@ -57,48 +55,41 @@ If \uicontrol Auto-detected still does not show the Qt version, select \uicontrol {Add} to add it manually. - For more information, see \l{Add Qt versions}. - Also check that \preferences > \uicontrol Kits > \uicontrol {Compilers} shows your compiler. - For more information, see \l{Add compilers}. + Connect devices to the computer via USB to run, debug, and analyze + applications on them. You can connect Linux-based devices also + over a WLAN. Configure a connection between \QC and the computer, and + select the device in a kit. - You can connect devices to the development PC to run, debug, and - analyze applications on them from \QC. You can connect the device to the - development PC via USB. Additionally, you can connect Linux-based devices - over a WLAN. You must also configure a connection between \QC and the - development PC and specify the device in a kit. + To add devices, go to \preferences > \uicontrol Devices > + \uicontrol Devices and select \uicontrol Add. - To add devices, select \preferences > \uicontrol Devices > - \uicontrol Devices > \uicontrol Add. - - For more information, see \l{Develop for Devices}. + For more information, see \l{Manage Kits}{How To: Manage Kits} and + \l{Develop for Devices}{How To: Develop for Devices}. \section1 Changing Keyboard Shortcuts You can use \QC with your favorite keyboard shortcuts. - To view and edit all keyboard shortcuts defined in \QC, select - \preferences > - \uicontrol Environment > - \uicontrol Keyboard. For more information, see \l{Keyboard Shortcuts}. + To view and edit all keyboard shortcuts defined in \QC, go to \preferences > + \uicontrol Environment > \uicontrol Keyboard. For more information, see + \l{Keyboard Shortcuts}. \section1 Changing Color Schemes - Themes enable you to customize the appearance of the \QC UI: widgets, - colors, and icons. + Themes set the appearance of the \QC UI: widgets, colors, and icons. - To switch themes, select \preferences > \uicontrol Environment > - \uicontrol Interface, and then select a theme in the \uicontrol Theme field. + To switch themes, go to \preferences > \uicontrol Environment > + \uicontrol Interface and select a theme in \uicontrol Theme. - You can use the \QC text and code editors with your favorite color scheme - that defines how to highlight code elements and which background color to - use. You can select one of the predefined color schemes or create custom - ones. The color schemes apply to highlighting C++ files, QML files, and - generic files. + Use the \QC text and code editors with your favorite color scheme that sets + highlighting of code elements and the background color. Select one of the + predefined color schemes or create custom ones. The color schemes apply to + highlighting C++ files, QML files, and generic files. - To change the color scheme, select \preferences > + To change the color scheme, go to \preferences > \uicontrol {Text Editor} > \uicontrol {Font & Colors}. For more information, see \l{Change editor colors}. @@ -108,7 +99,7 @@ highlighting engine for Kate syntax definitions. \QC comes with most of the commonly used syntax files, and you can download additional files. - To download and use highlight definition files, select \preferences > + To download and use highlight definition files, go to \preferences > \uicontrol {Text Editor} > \uicontrol {Generic Highlighter}. For more information, see \l{Download highlight definitions}. @@ -117,10 +108,10 @@ As you write code, \QC suggests properties, IDs, and code snippets to complete the code. It lists context-sensitive suggestions for - the statement currently under your cursor. You can add, modify, and remove + the statement currently under your cursor. Add, modify, and remove snippets in the snippet editor. - To open the snippet editor, select \preferences > + To open the snippet editor, go to \preferences > \uicontrol {Text Editor} > \uicontrol Snippets. For more information, see \l{Snippets}. @@ -131,8 +122,7 @@ to configure the version control in any special way to make it work with \QC. - However, some configuration options are available and you can set them in - \preferences > + However, you can set some configuration options in \preferences > \uicontrol {Version Control} > \uicontrol General. For more information about the supported functions, see @@ -144,13 +134,15 @@ You can \l{Enable and disable plugins}{enable} disabled plugins if you need them and disable plugins you don't need. - You can \l{Install plugins}{download and install} more plugins from + \l{Install plugins}{Download and install} more plugins from \l{https://marketplace.qt.io/}{Qt Marketplace} or some other source, such as \l{https://github.com/}{GitHub}. - To enable and disable plugins, select \uicontrol Help > + To enable and disable plugins, go to \uicontrol Help > \uicontrol {About Plugins}. - To install plugins, select \uicontrol Help > \uicontrol {About Plugins} > - \uicontrol {Install Plugins}. + To install plugins, go to \uicontrol Help > \uicontrol {About Plugins} and + select \uicontrol {Install Plugins}. + + \sa {Install \QC}, {Reset \QC settings}, {Preferences} */ From 36ec16a34c5a4f21c89cd360b7f6f00ff56b6b89 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 14 May 2024 15:39:16 +0200 Subject: [PATCH 45/45] Add change log for 14.0.0 Change-Id: I5350a15dc342ced4e181338443dfe44b0cf1bd5c Reviewed-by: Leena Miettinen --- dist/changelog/changes-14.0.0.md | 294 +++++++++++++++++++++++++++++++ dist/changelog/template.md | 6 + 2 files changed, 300 insertions(+) create mode 100644 dist/changelog/changes-14.0.0.md diff --git a/dist/changelog/changes-14.0.0.md b/dist/changelog/changes-14.0.0.md new file mode 100644 index 00000000000..00ba593c720 --- /dev/null +++ b/dist/changelog/changes-14.0.0.md @@ -0,0 +1,294 @@ +Qt Creator 14 +============= + +Qt Creator version 14 contains bug fixes and new features. + +The most important changes are listed in this document. For a complete list of +changes, see the Git log for the Qt Creator sources that you can check out from +the public Git repository. For example: + + git clone git://code.qt.io/qt-creator/qt-creator.git + git log --cherry-pick --pretty=oneline origin/13.0..v14.0.0 + +General +------- + +* Added `Clear` and `Save Contents` to context menus of all output views +* Locator + * Added the option to show results relative to project root + ([QTCREATORBUG-29462](https://bugreports.qt.io/browse/QTCREATORBUG-29462)) + +Editing +------- + +* Changed the default behavior when files change on disk to + `Reload All Unchanged Editors` +* Made the search options session-specific + ([QTCREATORBUG-793](https://bugreports.qt.io/browse/QTCREATORBUG-793)) +* Added menus with the navigation history to the back and forward buttons + ([QTCREATORBUG-347](https://bugreports.qt.io/browse/QTCREATORBUG-347)) +* Added a highlight for the current view in case of multiple views + ([QTCREATORBUG-23654](https://bugreports.qt.io/browse/QTCREATORBUG-23654)) +* Added `Window > Reopen Last Closed Document` +* Fixed that changing a document's MIME type by renaming did not re-open it in + the new editor type when needed + ([QTCREATORBUG-30317](https://bugreports.qt.io/browse/QTCREATORBUG-30317)) +* Fixed that after hiding the editor in `Debug` mode, `Edit` mode always opened + when opening documents, even if an external editor window was available + ([QTCREATORBUG-30408](https://bugreports.qt.io/browse/QTCREATORBUG-30408)) + +### C++ + +* Made C++ code model settings configurable per project +* Fixed indentation after function calls with subscript operator + ([QTCREATORBUG-29225](https://bugreports.qt.io/browse/QTCREATORBUG-29225)) +* Refactoring + * Added `Convert Function Call to Qt Meta-Method Invocation` + ([QTCREATORBUG-15972](https://bugreports.qt.io/browse/QTCREATORBUG-15972)) + * Added `Move Class to a Dedicated Set of Source Files` + ([QTCREATORBUG-12190](https://bugreports.qt.io/browse/QTCREATORBUG-12190)) + * Added `Re-order Member Function Definitions According to Declaration Order` + ([QTCREATORBUG-6199](https://bugreports.qt.io/browse/QTCREATORBUG-6199)) + * Added triggers for `Add Curly Braces` + * Fixed issues with macros + ([QTCREATORBUG-10279](https://bugreports.qt.io/browse/QTCREATORBUG-10279)) +* Clangd + * Increased the minimum version to LLVM 17 + * Added an option for the index location + ([QTCREATORBUG-27346](https://bugreports.qt.io/browse/QTCREATORBUG-27346)) + * Made reparsing source files while editing header files optional + ([QTCREATORBUG-29943](https://bugreports.qt.io/browse/QTCREATORBUG-29943)) + * Fixed the handling of system headers + ([QTCREATORBUG-30474](https://bugreports.qt.io/browse/QTCREATORBUG-30474)) +* Built-in + * Added the option to disable the built-in indexer + ([QTCREATORBUG-29147](https://bugreports.qt.io/browse/QTCREATORBUG-29147)) + * Added an option for "statement macros" that are interpreted by the indenter + as complete statements that don't require a semicolon at the end + ([QTCREATORBUG-13640](https://bugreports.qt.io/browse/QTCREATORBUG-13640), + [QTCREATORBUG-15069](https://bugreports.qt.io/browse/QTCREATORBUG-15069), + [QTCREATORBUG-18789](https://bugreports.qt.io/browse/QTCREATORBUG-18789)) + ([Clang Format Documentation](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#statementmacros)) + * Added indentation support for `try-catch` statements + ([QTCREATORBUG-29452](https://bugreports.qt.io/browse/QTCREATORBUG-29452)) + +### QML + +* Improved support for enums + ([QTCREATORBUG-19226](https://bugreports.qt.io/browse/QTCREATORBUG-19226)) +* Added `Qt Design Studio` to `Open With` for `.ui.qml`-files +* Language Server + * Switched on by default + * Added option for generating `qmlls.ini` files for CMake projects + ([QTCREATORBUG-30394](https://bugreports.qt.io/browse/QTCREATORBUG-30394)) + ([Qt Documentation](https://doc.qt.io/qt-6/cmake-variable-qt-qml-generate-qmlls-ini.html)) + * Fixed that tool tips from the built-in model were shown instead of tool tips + from the server + +### Python + +* Added the option to install Python LSP updates + +### Language Server Protocol + +* Added support for `SymbolTag` + ([Protocol Documentation](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag)) +* Added support for type hierarchy + ([QTCREATORBUG-28116](https://bugreports.qt.io/browse/QTCREATORBUG-28116)) + +### Compiler Explorer + +* Added a wizard template for code that uses Qt + +### Models + +* Added more visual attributes for relations +* Added support for linked files +* Added support for custom images + +### SCXML + +* Added visualization of conditions on transitions + ([QTCREATORBUG-21946](https://bugreports.qt.io/browse/QTCREATORBUG-21946)) + +Projects +-------- + +* Added the option to hide all unconfigured kits from the list in `Projects` + mode +* Added support for user comments in the environment editor +* Fixed the parsing of file links when color was used for the output + ([QTCREATORBUG-30774](https://bugreports.qt.io/browse/QTCREATORBUG-30774)) +* Fixed that the column information was not used when opening files from links + in issues +* Fixed changing the case of file names on case-insensitive file systems + ([QTCREATORBUG-30846](https://bugreports.qt.io/browse/QTCREATORBUG-30846)) +* Fixed that Qt Creator variables were not expanded for the `Copy File` + deploy step + ([QTCREATORBUG-30821](https://bugreports.qt.io/browse/QTCREATORBUG-30821)) + +### CMake + +* Made CMake settings configurable per project +* Implemented `Open Online Documentation` for CMake documentation +* Added `Clear CMake Configuration` to the context menu in the Projects view + ([QTCREATORBUG-24658](https://bugreports.qt.io/browse/QTCREATORBUG-24658)) +* Fixed that the package manager auto-setup files were not removed with + `Clear CMake Configuration` + ([QTCREATORBUG-30771](https://bugreports.qt.io/browse/QTCREATORBUG-30771)) +* Fixed that files generated by the Qt QML CMake API were not filtered as + generated files + ([QTCREATORBUG-29631](https://bugreports.qt.io/browse/QTCREATORBUG-29631)) +* Presets + * Made CMake settings configurable + ([QTCREATORBUG-25972](https://bugreports.qt.io/browse/QTCREATORBUG-25972), + [QTCREATORBUG-29559](https://bugreports.qt.io/browse/QTCREATORBUG-29559), + [QTCREATORBUG-30385](https://bugreports.qt.io/browse/QTCREATORBUG-30385)) + * Made it possible to register debuggers + * Added support for custom build types + +### Workspace + +* Added `File > Open Workspace` for opening a directory as a project. A project + file `.qtcreator/project.json` in the directory is used to set a name and + file exclusion filters. + +Debugging +--------- + +### C++ + +* Improved performance +* GDB + * Added a setting for `debuginfod` + ([QTCREATORBUG-28868](https://bugreports.qt.io/browse/QTCREATORBUG-28868)) +* CDB + * Fixed the display type of `HRESULT` + ([QTCREATORBUG-30574](https://bugreports.qt.io/browse/QTCREATORBUG-30574)) + +Analyzer +-------- + +### Clang + +* Added the option to `Suppress Diagnostics Inline` + ([QTCREATORBUG-24847](https://bugreports.qt.io/browse/QTCREATORBUG-24847)) + ([Clazy Documentation](https://github.com/KDE/clazy?tab=readme-ov-file#reducing-warning-noise)) + ([clang-tidy Documentation](https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics)) + +### Axivion + +* Made it possible to register multiple servers + +Terminal +-------- + +* Fixed resizing on Windows + ([QTCREATORBUG-30558](https://bugreports.qt.io/browse/QTCREATORBUG-30558)) + +Version Control Systems +----------------------- + +### Git + +* Fixed that email and author mapping was not used for logs and showing changes + +Test Integration +---------------- + +* Made the test timeout optional + ([QTCREATORBUG-30668](https://bugreports.qt.io/browse/QTCREATORBUG-30668)) +* Added a project specific option `Limit Files to Path Patterns` for restricting + the search for tests + +### Qt Test + +* Fixed the order of test execution + ([QTCREATORBUG-30670](https://bugreports.qt.io/browse/QTCREATORBUG-30670)) + +Platforms +--------- + +### Linux + +* Adapted the default theme to the system theme +* Fixed issues with light themes on dark system themes + ([QTCREATORBUG-18281](https://bugreports.qt.io/browse/QTCREATORBUG-18281), + [QTCREATORBUG-20889](https://bugreports.qt.io/browse/QTCREATORBUG-20889), + [QTCREATORBUG-26817](https://bugreports.qt.io/browse/QTCREATORBUG-26817), + [QTCREATORBUG-28589](https://bugreports.qt.io/browse/QTCREATORBUG-28589), + [QTCREATORBUG-30138](https://bugreports.qt.io/browse/QTCREATORBUG-30138)) +* Fixed that recent projects on unavailable remote devices regularly + froze Qt Creator + ([QTCREATORBUG-30681](https://bugreports.qt.io/browse/QTCREATORBUG-30681)) + +### Android + +* Added support for creating `android-desktop` devices +* Added support for `namespace` in `build.gradle` + ([QTBUG-106907](https://bugreports.qt.io/browse/QTBUG-106907)) + +### iOS + +* Removed Simulator management from the preferences. Use the + `Devices and Simulators` window in Xcode instead. + +### Remote Linux + +* Added the option to use SSH port forwarding for debugging +* Improved the performance of the generic deployment method +* Fixed that the file size check that is performed before parsing C++ files + could freeze Qt Creator until finished for remote projects + +### Qt Application Manager + +* Added support for the `perf` profiler + +Credits for these changes go to: +-------------------------------- +Ahmad Samir +Aleksei German +Alessandro Portale +Alexander Drozdov +Ali Kianian +Andre Hartmann +André Pönitz +Artem Sokolovskii +Assam Boudjelthia +BogDan Vatra +Brook Cronin +Burak Hancerli +Christian Kandeler +Christian Stenger +Cristian Adam +David Schulz +Dominik Holland +Eike Ziller +Esa Törmänen +Henning Gruendl +Jaroslaw Kobus +Jiajie Chen +Jochen Becher +Johanna Vanhatapio +Jussi Witick +Knud Dollereder +Leena Miettinen +Mahmoud Badri +Marco Bubke +Marcus Tillmanns +Mathias Hasselmann +Mats Honkamaa +Michael Weghorn +Miikka Heikkinen +Orgad Shaneh +Pranta Dastider +Robert Löhning +Sami Shalayel +Sergey Silin +Shrief Gabr +Teea Poldsam +Thiago Macieira +Thomas Hartmann +Tim Jenßen +Vikas Pachdha +Xavier Besson diff --git a/dist/changelog/template.md b/dist/changelog/template.md index 9fe0d1f1f7a..cfbdad4677f 100644 --- a/dist/changelog/template.md +++ b/dist/changelog/template.md @@ -44,6 +44,8 @@ Editing ### Models +### SCXML + ### Binary Files Projects @@ -57,6 +59,8 @@ Projects ### Python +### Workspace + ### vcpkg ### Qt Safe Renderer @@ -119,6 +123,8 @@ Platforms ### MCU +### Qt Application Manager + ### QNX Credits for these changes go to: