From 88edec1bf4f970c196466670951206f6fbd4f2b9 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 23 Sep 2024 11:33:08 +0200 Subject: [PATCH 1/5] TextEditor: Avoid divide by zero error And adding a few asserts in places that could cause this to happen. Fixes: QTCREATORBUG-31623 Change-Id: I8de5db14313791b1d6614dc0e29d0d3dd65e8542 Reviewed-by: Eike Ziller --- src/plugins/texteditor/fontsettings.cpp | 3 ++- src/plugins/texteditor/texteditor.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index 3cb58fd1282..54e384984b3 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -103,6 +103,7 @@ bool FontSettings::fromSettings(const FormatDescriptions &descriptions, const Qt m_fontSize = s->value(group + fontSizeKey, m_fontSize).toInt(); m_fontZoom= s->value(group + fontZoomKey, m_fontZoom).toInt(); m_lineSpacing = s->value(group + lineSpacingKey, m_lineSpacing).toInt(); + QTC_ASSERT(m_lineSpacing >= 0, m_lineSpacing = 100); m_antialias = s->value(group + antialiasKey, DEFAULT_ANTIALIAS).toBool(); if (s->contains(group + schemeFileNamesKey)) { @@ -337,7 +338,7 @@ qreal FontSettings::lineSpacing() const QFont currentFont = font(); currentFont.setPointSize(std::max(m_fontSize * m_fontZoom / 100, 1)); qreal spacing = QFontMetricsF(currentFont).lineSpacing(); - if (m_lineSpacing != 100) + if (QTC_GUARD(m_lineSpacing > 0) && m_lineSpacing != 100) spacing *= qreal(m_lineSpacing) / 100; return spacing; } diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 8ced95c0fc0..4d71d42c45b 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -5160,6 +5160,7 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data, q->viewport()->update(annotationRect.rect.toAlignedRect()); } m_annotationRects[data.block.blockNumber()] = newRects; + QTC_ASSERT(data.lineSpacing != 0, return); const int maxVisibleLines = data.viewportRect.height() / data.lineSpacing; if (m_annotationRects.size() >= maxVisibleLines * 2) scheduleCleanupAnnotationCache(); From 3004ebc0af36b165b8cfc7508752111c6a30b685 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 24 Sep 2024 14:23:53 +0200 Subject: [PATCH 2/5] LanguageClient: fix crash in call and type hierarchy The response to a request sent by Call or TypeHierarchy was still handled by deleted Hierarchy instances. This happens when a second request was sent before the first was handled. Make sure to cancel a potentially running request when destructing a hierarchy in order to prevent accessing the deleted instance. Change-Id: Icd810f7a6e9eb090b28f13cb1a3254f75a27cdbb Reviewed-by: Christian Kandeler --- .../languageclient/callandtypehierarchy.cpp | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/plugins/languageclient/callandtypehierarchy.cpp b/src/plugins/languageclient/callandtypehierarchy.cpp index 4b8f7117132..71a9558f34e 100644 --- a/src/plugins/languageclient/callandtypehierarchy.cpp +++ b/src/plugins/languageclient/callandtypehierarchy.cpp @@ -287,6 +287,12 @@ public: theWidget, [this](const QModelIndex &index) { onItemDoubleClicked(index); }); } + ~HierarchyWidgetHelper() + { + if (m_runningRequest && m_runningRequest->first) + m_runningRequest->first->cancelRequest(m_runningRequest->second); + } + void updateHierarchyAtCursorPosition() { m_model.clear(); @@ -315,6 +321,17 @@ protected: item->forChildrenAtLevel(1, [&](const TreeItem *child) { m_view->expand(child->index()); }); } + void send(Client *client, const JsonRpcMessage &request, const MessageId &requestId) + { + m_runningRequest = std::make_pair(QPointer(client), requestId); + client->sendMessage(request); + } + + void resetRunningRequest() + { + m_runningRequest.reset(); + } + private: virtual void sendRequest(Client *client, const TextDocumentPositionParams ¶ms, const Core::IDocument *document) = 0; @@ -334,6 +351,7 @@ private: AnnotatedItemDelegate m_delegate; NavigationTreeView * const m_view; + std::optional, MessageId>> m_runningRequest; TreeModel m_model; }; @@ -358,12 +376,13 @@ private: const PrepareCallHierarchyRequest::Response &response) { handlePrepareResponse(client, response); }); - client->sendMessage(request); + send(client, request, request.id()); } void handlePrepareResponse(Client *client, const PrepareCallHierarchyRequest::Response &response) { + resetRunningRequest(); if (!client) return; const std::optional error = response.error(); @@ -401,12 +420,13 @@ private: const PrepareTypeHierarchyRequest::Response &response) { handlePrepareResponse(client, response); }); - client->sendMessage(request); + send(client, request, request.id()); } void handlePrepareResponse(Client *client, const PrepareTypeHierarchyRequest::Response &response) { + resetRunningRequest(); if (!client) return; const std::optional error = response.error(); From 6a8f3d82d299ecb35ff85c76b293c190f6ba5f11 Mon Sep 17 00:00:00 2001 From: Sami Shalayel Date: Tue, 24 Sep 2024 16:40:12 +0200 Subject: [PATCH 3/5] QtQuickApplication Template: set mininum Qt version Don't set the version in the find_package()-call as that overrides the Qt kit selected in the wizard by the user, when available. Instead, set the REQUIRES to the manually selected minimum version. Task-number: QTCREATORBUG-31628 Change-Id: Ic010b4bcfb7e1065d8dcc2d7fe726d32f76dafb3 Reviewed-by: Ulf Hermann Reviewed-by: Fabian Kosmale --- .../wizards/projects/qtquickapplication/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt index 5ab817b9bfe..d7ae810c033 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt @@ -7,11 +7,11 @@ set(CMAKE_AUTOMOC ON) @endif set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(Qt6 %{MinimumSupportedQtVersion} REQUIRED COMPONENTS Quick) +find_package(Qt6 REQUIRED COMPONENTS Quick) @if %{HasQSPSetup} @if %{UsesAutoResourcePrefix} -qt_standard_project_setup(REQUIRES 6.5) +qt_standard_project_setup(REQUIRES %{MinimumSupportedQtVersion}) @else qt_standard_project_setup() @endif From 52d994e2abe198504f1777c0e9afbacc4e6d28b2 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 26 Sep 2024 16:40:17 +0200 Subject: [PATCH 4/5] Tracing: Drop padding from ImageToolButton's background It does not seem to make much of a difference and PaddedRectangle was not supposed to be available from QtQuick.Controls. Task-number: QTBUG-129390 Change-Id: I7fdcaaef27066cb61bbd3d8e3fef3643c5f4ffa7 Reviewed-by: Alessandro Portale --- src/libs/tracing/qml/ImageToolButton.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/tracing/qml/ImageToolButton.qml b/src/libs/tracing/qml/ImageToolButton.qml index 45ca12b8997..ebbc8e28907 100644 --- a/src/libs/tracing/qml/ImageToolButton.qml +++ b/src/libs/tracing/qml/ImageToolButton.qml @@ -22,8 +22,7 @@ ToolButton { smooth: false } - background: PaddedRectangle { - padding: Theme.compactToolbar() ? 0 : 3 + background: Rectangle { radius: Theme.compactToolbar() ? 0 : 5 color: (parent.checked || parent.pressed) ? Theme.color(Theme.FancyToolButtonSelectedColor) From bba179912b2fcdd32b3cbd6e71df4442d1044fd7 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Fri, 27 Sep 2024 15:59:27 +0200 Subject: [PATCH 5/5] Doc: Add info about Qt Creator licenses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTCREATORBUG-31653 Change-Id: Ib203d428940eceb8bbbdecda731d077dc8163492 Reviewed-by: Kai Köhne --- doc/qtcreator/config/style/qt5-sidebar.html | 2 +- .../src/howto/creator-only/creator-how-to-install.qdoc | 3 ++- .../src/overview/creator-acknowledgements.qdoc | 10 ++++++++-- doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc | 2 +- doc/qtdesignstudio/src/qtdesignstudio.qdoc | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/qtcreator/config/style/qt5-sidebar.html b/doc/qtcreator/config/style/qt5-sidebar.html index c5c9f62c161..e9bdbfb1da8 100644 --- a/doc/qtcreator/config/style/qt5-sidebar.html +++ b/doc/qtcreator/config/style/qt5-sidebar.html @@ -70,7 +70,7 @@

Reference

    -
  • Acknowledgements
  • +
  • Licenses and Acknowledgments
  • Command-Line Options
  • Custom Wizards
  • FAQ
  • diff --git a/doc/qtcreator/src/howto/creator-only/creator-how-to-install.qdoc b/doc/qtcreator/src/howto/creator-only/creator-how-to-install.qdoc index f64c870cfe0..fad52f18617 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-how-to-install.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-how-to-install.qdoc @@ -88,5 +88,6 @@ {Compiling \QC} and \l{https://wiki.qt.io/Building_Qt_Creator_from_Git} {Building Qt Creator from Git}. - \sa {Manage Kits}{How To: Manage Kits}, {Register installed Qt versions} + \sa {Manage Kits}{How To: Manage Kits}, {Register installed Qt versions}, + {Install plugins}, {Licenses and Acknowledgments} */ diff --git a/doc/qtcreator/src/overview/creator-acknowledgements.qdoc b/doc/qtcreator/src/overview/creator-acknowledgements.qdoc index e69626b35cf..f1ccb416af0 100644 --- a/doc/qtcreator/src/overview/creator-acknowledgements.qdoc +++ b/doc/qtcreator/src/overview/creator-acknowledgements.qdoc @@ -17,9 +17,15 @@ \ingroup creator-reference - \title Acknowledgements + \title Licenses and Acknowledgments - \brief Third-party components in \QC. + \brief Licenses and third-party components in \QC. + + \section1 Licenses + + \QC is available under commercial licenses from The Qt Company, and + under the GNU General Public License version 3, annotated with + The Qt Company GPL Exception 1.0. \section1 Credits diff --git a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc index 6b3680de546..bb3b0dd7646 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc @@ -270,6 +270,6 @@ \li \l{Supported Platforms} \endlist \li \l{Technical Support} - \li \l{Acknowledgements} + \li \l{Licenses and Acknowledgments} \endlist */ diff --git a/doc/qtdesignstudio/src/qtdesignstudio.qdoc b/doc/qtdesignstudio/src/qtdesignstudio.qdoc index d3a0b007d12..a68d2ca1228 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio.qdoc @@ -98,6 +98,6 @@ \uicontrol {System Information}. For credits and a list of third-party libraries, see - \l {Acknowledgements}. + \l {Licenses and Acknowledgments}. \endtable */