diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index a1d4c93fa00..eaf3013fcfa 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -62,9 +62,11 @@ jobs: execute_process(COMMAND git submodule set-url -- perfparser https://code.qt.io/qt-creator/perfparser.git) execute_process(COMMAND git submodule update --init --recursive) file(MAKE_DIRECTORY release) - if (${{github.ref}} MATCHES "tags/v(.*)") + if (${{github.ref}} MATCHES "tags/v([0-9.]+)") file(APPEND "$ENV{GITHUB_OUTPUT}" "tag=${CMAKE_MATCH_1}\n") - file(READ "dist/changelog/changes-${CMAKE_MATCH_1}.md" changelog_md) + if (EXISTS "dist/changelog/changes-${CMAKE_MATCH_1}.md") + file(READ "dist/changelog/changes-${CMAKE_MATCH_1}.md" changelog_md) + endif() file(WRITE "release/changelog.md" "These packages are not officially supported, for official packages please check out https://download.qt.io/official_releases/qtcreator\n\n") file(APPEND "release/changelog.md" "${changelog_md}") else() diff --git a/doc/qtcreator/images/qtcreator-file-new-file-vcpkg-manifest-file.webp b/doc/qtcreator/images/qtcreator-file-new-file-vcpkg-manifest-file.webp new file mode 100644 index 00000000000..f8690aab650 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-file-new-file-vcpkg-manifest-file.webp differ diff --git a/doc/qtcreator/images/qtcreator-file-new-file-vcpkg.webp b/doc/qtcreator/images/qtcreator-file-new-file-vcpkg.webp new file mode 100644 index 00000000000..9cebc6932aa Binary files /dev/null and b/doc/qtcreator/images/qtcreator-file-new-file-vcpkg.webp differ diff --git a/doc/qtcreator/images/qtcreator-preferences-cmake-general.webp b/doc/qtcreator/images/qtcreator-preferences-cmake-general.webp index 2eef4e57ee2..e6b7de61f33 100644 Binary files a/doc/qtcreator/images/qtcreator-preferences-cmake-general.webp and b/doc/qtcreator/images/qtcreator-preferences-cmake-general.webp differ diff --git a/doc/qtcreator/images/qtcreator-preferences-cmake-vcpkg.webp b/doc/qtcreator/images/qtcreator-preferences-cmake-vcpkg.webp new file mode 100644 index 00000000000..62a8b8d7857 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-preferences-cmake-vcpkg.webp differ diff --git a/doc/qtcreator/images/qtcreator-vcpkg-manifest-file-editor.webp b/doc/qtcreator/images/qtcreator-vcpkg-manifest-file-editor.webp new file mode 100644 index 00000000000..1d341a081f4 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-vcpkg-manifest-file-editor.webp differ diff --git a/doc/qtcreator/images/qtcreator-vcpkg-package-selector.webp b/doc/qtcreator/images/qtcreator-vcpkg-package-selector.webp new file mode 100644 index 00000000000..97295b6b485 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-vcpkg-package-selector.webp differ diff --git a/doc/qtcreator/src/conan/creator-projects-conan.qdoc b/doc/qtcreator/src/conan/creator-projects-conan.qdoc index 2076a10f90b..905e486c9ea 100644 --- a/doc/qtcreator/src/conan/creator-projects-conan.qdoc +++ b/doc/qtcreator/src/conan/creator-projects-conan.qdoc @@ -4,7 +4,7 @@ /*! \page creator-project-conan.html \previouspage creator-project-incredibuild.html - \nextpage creator-cli.html + \nextpage creator-vcpkg.html \title Setting Up Conan diff --git a/doc/qtcreator/src/howto/creator-only/creator-cli.qdoc b/doc/qtcreator/src/howto/creator-only/creator-cli.qdoc index 4a7d5435781..7634b9ce395 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-cli.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-cli.qdoc @@ -8,7 +8,7 @@ // ********************************************************************** /*! - \previouspage creator-project-conan.html + \previouspage creator-project-vcpkg.html \page creator-cli.html \nextpage creator-keyboard-shortcuts.html diff --git a/doc/qtcreator/src/howto/creator-only/creator-vcpkg.qdoc b/doc/qtcreator/src/howto/creator-only/creator-vcpkg.qdoc new file mode 100644 index 00000000000..84b3580bd69 --- /dev/null +++ b/doc/qtcreator/src/howto/creator-only/creator-vcpkg.qdoc @@ -0,0 +1,88 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \page creator-vcpkg.html + \previouspage creator-project-conan.html + \nextpage creator-cli.html + + \title Managing Packages with vcpkg + + The experimental vcpkg plugin integrates the \l {https://vcpkg.io/en/}{vcpkg} + C/C++ package manager into \QC. It's available on all the + \l{Supported Platforms}{supported development platforms}. + + You can use \QC to create and edit vcpkg.json files to specify packages to + build as part of your project when using CMake as the build system. + + \section1 Enabling the vcpkg Plugin + + To enable the vcpkg plugin: + + \list 1 + \li Select \uicontrol Help > \uicontrol {About Plugins} > + \uicontrol Utilities > \uicontrol Vcpkg to enable the plugin. + \li Select \uicontrol {Restart Now} to restart \QC and load the plugin. + \endlist + + \section1 Setting vcpkg Preferences + + By default, vcpkg is automatically set up for use with CMake. To disable + automatic setup, select \uicontrol Edit > \uicontrol Preferences > + \uicontrol CMake > \uicontrol General > + \uicontrol {Package manager auto setup}. + + \image qtcreator-preferences-cmake-general.webp {General tab in CMake Preferences} + + To set the \uicontrol Path to the directory where you installed vcpkg, select + \uicontrol Edit > \uicontrol Preferences > \uicontrol CMake > + \uicontrol Vcpkg. + + \image qtcreator-preferences-cmake-vcpkg.webp {Vcpkg tab in CMake Preferences} + + Select \inlineimage icons/online.png + to download vcpkg if you have not installed it yet. + + \section1 Creating vcpkg Manifest Files + + To create a new vcpkg package manager manifest (vcpkg.json) file: + + \list 1 + \li Select \uicontrol File > \uicontrol {New File} > + \uicontrol Vcpkg. + \image qtcreator-file-new-file-vcpkg-manifest-file.webp {vcpkg.json Manifest File wizard page} + \li In \uicontrol Name, enter a name for the manifest file. + \li In \uicontrol Version, enter a version number for the file. + \li In \uicontrol Dependencies, enter the packages to manage. + + You can add packages later in a manifest editor. + \li Select \uicontrol Next to open the \uicontrol {Project Management} + page. + \li Select \uicontrol Finish to create the file. + \endlist + + The wizard automatically adds the vcpkg.json file to the CMakeLists.txt file + of the project. + + \section1 Selecting Packages to Manage + + When you open a vcpkg.json file, it opens in the manifest file editor: + + \image qtcreator-vcpkg-manifest-file-editor.webp {vcpkg.json file in the manifest file editor} + + To add a package to your project: + + \list 1 + \li Place the cursor on the line where you want to add a package. + \li Select the \inlineimage icons/zoom.png + (\uicontrol {Search Package}) button. + \image qtcreator-vcpkg-package-selector.webp {Package selector dialog} + \li Select the package to add to your project. + \li Select \uicontrol OK to return to the editor. + \li Repeat to add more packages. + \endlist + + To set the path to the directory where you installed vcpkg, select + \inlineimage icons/settings.png + (\uicontrol Configure) on the editor toolbar. +*/ diff --git a/doc/qtcreator/src/projects/creator-only/creator-files-creating.qdoc b/doc/qtcreator/src/projects/creator-only/creator-files-creating.qdoc index b0f188c0834..11319133271 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-files-creating.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-files-creating.qdoc @@ -11,7 +11,8 @@ \image qtcreator-new-file.webp {New File wizard} Use wizard templates to add individual files to your \l{Creating Projects} - {projects}: + {projects}. Select \uicontrol File > \uicontrol {New File} and + select the type of the file: \list \li \uicontrol {C/C++}: header and source files for new classes. @@ -28,6 +29,8 @@ files. \li \uicontrol {Java}: class files. \li \uicontrol {Python}: class and script files for Python projects. + \li \uicontrol {vcpkg} (experimental): \l {Managing Packages with vcpkg} + {vcpkg package manager} manifest files (vcpkg.json). \li \uicontrol {Nim} (experimental): empty Nim source and script files. \endlist diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc index 6ea2b20b036..7fb958592de 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc @@ -55,6 +55,12 @@ \section1 Using Project Wizards + To create a new project, select \uicontrol File > \uicontrol{New Project} and + select the type of your project. The contents of the wizard dialogs depend + on the project type and the \l{glossary-buildandrun-kit}{kits} that you + select in the \uicontrol {Kit Selection} dialog. Follow the instructions of + the wizard. + In the first step, you select a template for the project. You can filter templates (1) to view only those that apply to a particular target platform. @@ -117,11 +123,6 @@ \endtable - To create a new project, select \uicontrol File > \uicontrol{New Project} and - select the type of your project. The contents of the wizard dialogs depend - on the project type and the \l{glossary-buildandrun-kit}{kits} that you select in the - \uicontrol {Kit Selection} dialog. Follow the instructions of the wizard. - For examples of creating different types of projects, see \l{Tutorials}. diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-other.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-other.qdoc index d22e6f4266d..232bb7d4fa1 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-other.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-other.qdoc @@ -1,4 +1,4 @@ -// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only // ********************************************************************** @@ -67,6 +67,12 @@ project. You can use Conan with most build systems integrated into \QC. + \li \l{Managing Packages with vcpkg} + + The experimental vcpkg plugin integrates the + \l {https://vcpkg.io/en/}{vcpkg} C/C++ package manager into \QC. + Create and edit vcpkg.json files to specify packages to build as + part of your project when using CMake as the build system. \endlist */ diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-analyze.qdocinc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-analyze.qdocinc index eb3ea2992ac..f7adfa4cd2d 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-analyze.qdocinc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-analyze.qdocinc @@ -35,7 +35,7 @@ \endlist - For more information about the CallGrind and MemCheck settings, see: + For more information about the Callgrind and Memcheck settings, see: \list diff --git a/doc/qtcreator/src/qtcreator-toc.qdoc b/doc/qtcreator/src/qtcreator-toc.qdoc index b9649bb2b4b..ba7bbac7cee 100644 --- a/doc/qtcreator/src/qtcreator-toc.qdoc +++ b/doc/qtcreator/src/qtcreator-toc.qdoc @@ -235,6 +235,7 @@ \li \l{Setting Up Meson} \li \l{Setting Up IncrediBuild} \li \l{Setting Up Conan} + \li \l{Managing Packages with vcpkg} \endlist \li \l{Using Command Line Options} \li \l{Keyboard Shortcuts} diff --git a/doc/qtcreator/src/widgets/qtdesigner-plugins.qdoc b/doc/qtcreator/src/widgets/qtdesigner-plugins.qdoc index 82b64a127cc..f782199c379 100644 --- a/doc/qtcreator/src/widgets/qtdesigner-plugins.qdoc +++ b/doc/qtcreator/src/widgets/qtdesigner-plugins.qdoc @@ -34,10 +34,10 @@ and integrated into \QC. The correct folder to place the plugins depends on whether you use the standalone \QD or the integrated \QD. - The integrated \QD fetches plugins from the \c {\bin\plugins\designer} - directory in the \QC installation directory on Windows and Linux. For - information about how to configure plugins on \macos, see - \l{Configuring Qt Designer Plugins on \macos}. + The integrated \QD fetches plugins from the \QC installation directory. + Designer plugins are loaded from \c {\bin\plugins\designer} on Windows, + \c {/lib/Qt/plugins/designer} on Linux, and + \c {Qt Creator.app/Contents/PlugIns/designer} on macOS. To check which plugins were loaded successfully and which failed, choose \uicontrol Tools > \uicontrol {Form Editor} > @@ -49,81 +49,21 @@ of \c bin. To check which plugins were loaded successfully and which failed, choose \uicontrol Help > \uicontrol {About Plugins}. - \section2 Configuring Qt Designer Plugins on \macos - - On \macos, a GUI application must be built and run from a bundle. A bundle - is a directory structure that appears as a single entity when viewed in the - Finder. A bundle for an application typically has the executable and - all the resources it needs. - - \QC uses its own set of Qt Libraries located in the bundle, and therefore, - you need to configure the \QD plugins that you want to use with \QC. - For more information about how to deploy applications to \macos, see - \l{Qt for macOS - Deployment}. - - The following example illustrates how to configure version 5.2.1 of the - \l{http://qwt.sourceforge.net/}{Qwt - Qt Widgets for Technical Applications} - library for use with \QC: - - \list 1 - - \li To check the paths used in the Qwt library, enter the following - \c otool command: - - \include doc_src_plugins.qdocinc 0 - - The output for Qwt 5.2.1 indicates that the plugin uses Qt core - libraries (QtDesigner, QtScript, QtXml, QtGui and QtCore) and - libqwt.5.dylib: - - \include doc_src_plugins.qdocinc 1 - - - \li You must copy the \QD plugin and the Qwt library files to the - following locations: - - \list - - \li \c {libqwt_designer_plugin.dylib} to - \c {Qt Creator.app/Contents/PlugIns/designer} - - \li \c {libqwt.*.dylib} to \c {Qt Creator.app/Contents/Frameworks} - - \endlist - - Enter the following commands: - - \include doc_src_plugins.qdocinc 4 - - \li Enter the following \c otool command to check the libraries that are - used by the Qwt library: - - \include doc_src_plugins.qdocinc 2 - - The command returns the following output: - - \include doc_src_plugins.qdocinc 3 - - \li Enter the following \c install_name_tool command to fix the - references of the libraries: - - \include doc_src_plugins.qdocinc 5 - - \endlist - \section1 Matching Build Keys The \QC that is included in pre-built Qt packages on Windows is built with - the Microsoft Visual Studio compiler, whereas the version of Qt shipped for - building applications is configured and built to use the \MinGW/g++ compiler. - Plugins built by using this version of Qt cannot be loaded by \QC because - the build-keys do not match. The plugins can only be used in the standalone + the Microsoft Visual Studio compiler. If you install a Qt version that was built + with the \MinGW/g++ compiler, plugins built with this version of Qt cannot be + loaded by \QC because the build-keys do not match. + The same is true if you use a Qt version that is newer than the Qt version that + Qt Creator was built with, or that is otherwise incompatible. + The plugins can then only be used in the standalone version of \QD. Choose \uicontrol Help > \uicontrol {About \QC} to check the - Qt version \QC was built with. + Qt version and compiler that \QC was built with. To use \QD plugins that were built for the shipped Qt version, make sure that \QC is built with the same compiler by either recompiling \QC using - \MinGW or recompiling Qt with Microsoft Visual Studio, depending on which - configuration you want to use for your applications. + \MinGW or installing a Qt version that was built with Microsoft Visual Studio, + depending on which configuration you want to use for your applications. */ diff --git a/src/libs/qmleditorwidgets/easingpane/easingcontextpane.h b/src/libs/qmleditorwidgets/easingpane/easingcontextpane.h index 570de97fd7a..b1690a79810 100644 --- a/src/libs/qmleditorwidgets/easingpane/easingcontextpane.h +++ b/src/libs/qmleditorwidgets/easingpane/easingcontextpane.h @@ -12,10 +12,10 @@ class QSpinBox; class QDoubleSpinBox; class QGraphicsView; class QVariant; -QT_END_NAMESPACE - class EasingGraph; +QT_END_NAMESPACE + namespace QmlJS { class PropertyReader; } namespace QmlEditorWidgets { diff --git a/src/libs/qmljs/parser/qmljslexer_p.h b/src/libs/qmljs/parser/qmljslexer_p.h index 1d2195369ad..9182f2ead88 100644 --- a/src/libs/qmljs/parser/qmljslexer_p.h +++ b/src/libs/qmljs/parser/qmljslexer_p.h @@ -20,9 +20,11 @@ #include #include -QT_QML_BEGIN_NAMESPACE - +QT_BEGIN_NAMESPACE class QDebug; +QT_END_NAMESPACE + +QT_QML_BEGIN_NAMESPACE namespace QmlJS { diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 78d93fb6c5d..2a41f472d7b 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -697,12 +697,19 @@ Check::Check(Document::Ptr doc, const ContextPtr &context, Utils::QtcSettings *q _enabledMessages = Utils::toSet(Message::allMessageTypes()); if (qtcSettings && qtcSettings->value("J.QtQuick/QmlJSEditor.useCustomAnalyzer").toBool()) { - auto disabled = qtcSettings->value("J.QtQuick/QmlJSEditor.disabledMessages").toList(); + auto toIntList = [](const QList list) { + return Utils::transform(list, [](StaticAnalysis::Type t) { return int(t); }); + }; + auto disabled = qtcSettings->value("J.QtQuick/QmlJSEditor.disabledMessages", + QVariant::fromValue( + toIntList(defaultDisabledMessages()))).toList(); for (const QVariant &disabledNumber : disabled) disableMessage(StaticAnalysis::Type(disabledNumber.toInt())); if (!isQtQuick2Ui()) { - auto disabled = qtcSettings->value("J.QtQuick/QmlJSEditor.disabledMessagesNonQuickUI").toList(); + auto disabled = qtcSettings->value("J.QtQuick/QmlJSEditor.disabledMessagesNonQuickUI", + QVariant::fromValue( + toIntList(defaultDisabledMessagesForNonQuickUi()))).toList(); for (const QVariant &disabledNumber : disabled) disableMessage(StaticAnalysis::Type(disabledNumber.toInt())); } diff --git a/src/libs/solutions/tasking/tasktree.cpp b/src/libs/solutions/tasking/tasktree.cpp index 9c14ec66091..2dabade3fcd 100644 --- a/src/libs/solutions/tasking/tasktree.cpp +++ b/src/libs/solutions/tasking/tasktree.cpp @@ -104,7 +104,7 @@ private: the Group stops the other running child tasks (if any - for example in parallel mode), and skips executing tasks it has not started yet (for example, in the sequential mode - those, that are placed after the failed task). Both stopping and skipping child tasks - may happen when parallelLimit is used. + may happen when parallelLimit() is used. The table below summarizes the differences between various workflow policies: @@ -170,7 +170,7 @@ private: as input to the next task before it starts. This mode guarantees that the next task is started only after the previous task finishes. - \sa parallel, parallelLimit + \sa parallel, parallelLimit() */ /*! @@ -181,7 +181,7 @@ private: without waiting for the previous child tasks to finish. In this mode, all child tasks run simultaneously. - \sa sequential, parallelLimit + \sa sequential, parallelLimit() */ /*! @@ -234,13 +234,13 @@ private: \value StopWithDone The group's or task's execution stops immediately with success. When returned from the group's setup handler, all child tasks are skipped, - and the group's onGroupDone handler is invoked (if provided). + and the group's onGroupDone() handler is invoked (if provided). When returned from the task's setup handler, the task isn't started, its done handler isn't invoked, and the task reports success to its parent. \value StopWithError The group's or task's execution stops immediately with an error. When returned from the group's setup handler, all child tasks are skipped, - and the group's onGroupError handler is invoked (if provided). + and the group's onGroupError() handler is invoked (if provided). When returned from the task's setup handler, the task isn't started, its error handler isn't invoked, and the task reports an error to its parent. */ @@ -250,7 +250,7 @@ private: Type alias for \c std::function. - The GroupSetupHandler is used when constructing the onGroupSetup element. + The GroupSetupHandler is used when constructing the onGroupSetup() element. Any function with the above signature, when passed as a group setup handler, will be called by the running task tree when the group execution starts. @@ -269,11 +269,11 @@ private: one of the group's done or error handlers is invoked. This behavior differs from that of task handlers and might change in the future. - The onGroupSetup accepts also functions in the shortened form of \c std::function, + The onGroupSetup() accepts also functions in the shortened form of \c std::function, i.e. the return value is void. In this case it's assumed that the return value is TaskAction::Continue by default. - \sa onGroupSetup + \sa onGroupSetup() */ /*! @@ -281,12 +281,12 @@ private: Type alias for \c std::function\. - The GroupEndHandler is used when constructing the onGroupDone and onGroupError elements. + The GroupEndHandler is used when constructing the onGroupDone() and onGroupError() elements. Any function with the above signature, when passed as a group done or error handler, will be called by the running task tree when the group ends with success or an error, respectively. - \sa onGroupDone, onGroupError + \sa onGroupDone(), onGroupError() */ /*! @@ -305,7 +305,7 @@ private: after the storages are constructed, so that the \a handler may already perform some initial modifications to the active storages. - \sa GroupItem::GroupSetupHandler, onGroupDone, onGroupError + \sa GroupItem::GroupSetupHandler, onGroupDone(), onGroupError() */ /*! @@ -320,7 +320,7 @@ private: before the storages are destructed, so that the \a handler may still perform a last read of the active storages' data. - \sa GroupItem::GroupEndHandler, onGroupSetup, onGroupError + \sa GroupItem::GroupEndHandler, onGroupSetup(), onGroupError() */ GroupItem onGroupDone(const GroupItem::GroupEndHandler &handler) { @@ -339,7 +339,7 @@ GroupItem onGroupDone(const GroupItem::GroupEndHandler &handler) before the storages are destructed, so that the \a handler may still perform a last read of the active storages' data. - \sa GroupItem::GroupEndHandler, onGroupSetup, onGroupDone + \sa GroupItem::GroupEndHandler, onGroupSetup(), onGroupDone() */ GroupItem onGroupError(const GroupItem::GroupEndHandler &handler) { @@ -1397,8 +1397,8 @@ void TaskNode::invokeEndHandler(bool success) \endcode The group setup handler is optional. To define a group setup handler, add an - onGroupSetup element to a group. The argument of onGroupSetup is a user - handler. If you add more than one onGroupSetup element to a group, an assert + onGroupSetup() element to a group. The argument of onGroupSetup() is a user + handler. If you add more than one onGroupSetup() element to a group, an assert is triggered at runtime that includes an error message. Like the task's start handler, the group start handler may return TaskAction. @@ -1481,7 +1481,7 @@ void TaskNode::invokeEndHandler(bool success) execution of its tasks, respectively. The final value reported by the group depends on its \l {Workflow Policy}. The handlers can apply other necessary actions. The done and error handlers are defined inside the - onGroupDone and onGroupError elements of a group, respectively. They do not + onGroupDone() and onGroupError() elements of a group, respectively. They do not take arguments: \code @@ -1494,7 +1494,7 @@ void TaskNode::invokeEndHandler(bool success) \endcode The group done and error handlers are optional. If you add more than one - onGroupDone or onGroupError each to a group, an assert is triggered at + onGroupDone() or onGroupError() each to a group, an assert is triggered at runtime that includes an error message. \note Even if the group setup handler returns StopWithDone or StopWithError, diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp index 4c824df6015..d04162e430f 100644 --- a/src/libs/utils/aspects.cpp +++ b/src/libs/utils/aspects.cpp @@ -671,6 +671,7 @@ public: // the validation changes focus by opening a dialog bool m_blockAutoApply = false; bool m_allowPathFromDevice = true; + bool m_validatePlaceHolder = false; template void updateWidgetFromCheckStatus(StringAspect *aspect, Widget *w) { @@ -985,6 +986,13 @@ void StringAspect::setAllowPathFromDevice(bool allowPathFromDevice) d->m_pathChooserDisplay->setAllowPathFromDevice(allowPathFromDevice); } +void StringAspect::setValidatePlaceHolder(bool validatePlaceHolder) +{ + d->m_validatePlaceHolder = validatePlaceHolder; + if (d->m_pathChooserDisplay) + d->m_pathChooserDisplay->lineEdit()->setValidatePlaceHolder(validatePlaceHolder); +} + /*! Sets \a elideMode as label elide mode. */ @@ -1131,6 +1139,7 @@ void StringAspect::addToLayout(LayoutItem &parent) d->m_pathChooserDisplay->setPromptDialogTitle(d->m_prompDialogTitle); d->m_pathChooserDisplay->setCommandVersionArguments(d->m_commandVersionArguments); d->m_pathChooserDisplay->setAllowPathFromDevice(d->m_allowPathFromDevice); + d->m_pathChooserDisplay->lineEdit()->setValidatePlaceHolder(d->m_validatePlaceHolder); if (defaultValue() == value()) d->m_pathChooserDisplay->setDefaultValue(defaultValue()); else @@ -1169,6 +1178,7 @@ void StringAspect::addToLayout(LayoutItem &parent) d->m_lineEditDisplay->setValidationFunction(d->m_validator); d->m_lineEditDisplay->setTextKeepingActiveCursor(displayedString); d->m_lineEditDisplay->setReadOnly(isReadOnly()); + d->m_lineEditDisplay->setValidatePlaceHolder(d->m_validatePlaceHolder); d->updateWidgetFromCheckStatus(this, d->m_lineEditDisplay.data()); addLabeledItem(parent, d->m_lineEditDisplay); useMacroExpander(d->m_lineEditDisplay); diff --git a/src/libs/utils/aspects.h b/src/libs/utils/aspects.h index 297842b3787..77315495392 100644 --- a/src/libs/utils/aspects.h +++ b/src/libs/utils/aspects.h @@ -407,6 +407,7 @@ public: void setAutoApplyOnEditingFinished(bool applyOnEditingFinished); void setElideMode(Qt::TextElideMode elideMode); void setAllowPathFromDevice(bool allowPathFromDevice); + void setValidatePlaceHolder(bool validatePlaceHolder); void validateInput(); diff --git a/src/libs/utils/externalterminalprocessimpl.cpp b/src/libs/utils/externalterminalprocessimpl.cpp index efdbc9aca31..3f8636665db 100644 --- a/src/libs/utils/externalterminalprocessimpl.cpp +++ b/src/libs/utils/externalterminalprocessimpl.cpp @@ -2,6 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "externalterminalprocessimpl.h" + +#include "algorithm.h" #include "process.h" #include "terminalcommand.h" #include "utilstr.h" @@ -19,43 +21,73 @@ ProcessStubCreator::ProcessStubCreator(TerminalInterface *interface) : m_interface(interface) {} +static const QLatin1String TerminalAppScript{R"( + tell application "Terminal" + activate + set newTab to do script "echo Preparing terminal..." + set win to (the id of window 1 where its tab 1 = newTab) as text + do script "%1 && exit" in newTab + repeat until ((count of processes of newTab) = 0) + delay 0.1 + end repeat + close window id win + end tell +)"}; + expected_str ProcessStubCreator::startStubProcess(const ProcessSetupData &setupData) { const TerminalCommand terminal = TerminalCommand::terminalEmulator(); - - if (HostOsInfo::isMacHost() && terminal.command == "Terminal.app") { - QTemporaryFile f; - f.setAutoRemove(false); - f.open(); - f.setPermissions(QFile::ExeUser | QFile::ReadUser | QFile::WriteUser); - f.write("#!/bin/sh\n"); - f.write(QString("cd %1\n").arg(setupData.m_workingDirectory.nativePath()).toUtf8()); - f.write("clear\n"); - f.write(QString("exec '%1' %2\n") - .arg(setupData.m_commandLine.executable().nativePath()) - .arg(setupData.m_commandLine.arguments()) - .toUtf8()); - f.close(); - - const QString path = f.fileName(); - const QString exe - = QString("tell app \"Terminal\" to do script \"'%1'; rm -f '%1'; exit\"").arg(path); - - Process process; - - process.setCommand({"osascript", {"-e", "tell app \"Terminal\" to activate", "-e", exe}}); - process.runBlocking(); - - if (process.exitCode() != 0) { - return make_unexpected( - Tr::tr("Failed to start terminal process: \"%1\"").arg(process.errorString())); - } - - return 0; - } - bool detached = setupData.m_terminalMode == TerminalMode::Detached; + if (HostOsInfo::isMacHost()) { + static const QMap terminalMap = { + {"Terminal.app", TerminalAppScript}, + }; + + if (terminalMap.contains(terminal.command.toString())) { + const QString env + = Utils::transform(setupData.m_environment.toStringList(), [](const QString &env) { + return CommandLine{"export", {env}}.toUserOutput(); + }).join('\n'); + const QString shScript = QString("cd '%1'\n%2\nclear\n'%3' %4\n") + .arg(setupData.m_workingDirectory.nativePath()) + .arg(env) + .arg(setupData.m_commandLine.executable().nativePath()) + .arg(setupData.m_commandLine.arguments()); + + Process *process = new Process(detached ? nullptr : this); + if (detached) + QObject::connect(process, &Process::done, process, &Process::deleteLater); + + QTemporaryFile *shFile = new QTemporaryFile(process); + QTC_ASSERT(shFile->open(), + return make_unexpected(Tr::tr("Failed to open temporary script file."))); + shFile->write(shScript.toUtf8()); + shFile->close(); + + FilePath::fromUserInput(shFile->fileName()) + .setPermissions(QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther | QFile::ReadUser + | QFile::ReadGroup | QFile::ReadOther | QFile::WriteUser + | QFile::WriteGroup | QFile::WriteOther); + + const QString script + = terminalMap.value(terminal.command.toString()).arg(shFile->fileName()); + + process->setCommand({"osascript", {"-"}}); + process->setWriteData(script.toUtf8()); + process->start(); + + if (!process->waitForStarted()) { + return make_unexpected( + Tr::tr("Failed to start terminal process: \"%1\".").arg(process->errorString())); + } + + QObject::connect(process, &Process::done, m_interface, &TerminalInterface::onStubExited); + + return 0; + } + } + Process *process = new Process(detached ? nullptr : this); if (detached) QObject::connect(process, &Process::done, process, &Process::deleteLater); @@ -77,11 +109,13 @@ expected_str ProcessStubCreator::startStubProcess(const ProcessSetupData process->setCommand(cmdLine); } + process->setEnvironment(setupData.m_environment); + process->start(); process->waitForStarted(); if (process->error() != QProcess::UnknownError) { return make_unexpected( - Tr::tr("Failed to start terminal process: \"%1\"").arg(process->errorString())); + Tr::tr("Failed to start terminal process: \"%1\".").arg(process->errorString())); } qint64 pid = process->processId(); diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index b06745c5066..2bf50a70fa1 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -112,6 +112,7 @@ public: bool m_isFiltering = false; bool m_firstChange = true; bool m_toolTipSet = false; + bool m_validatePlaceHolder = false; QString m_lastFilterText; @@ -469,6 +470,11 @@ QString FancyLineEdit::errorMessage() const return d->m_errorMessage; } +void FancyLineEdit::setValidatePlaceHolder(bool on) +{ + d->m_validatePlaceHolder = on; +} + void FancyLineEdit::validate() { const QString t = text(); @@ -501,7 +507,8 @@ void FancyLineEdit::validate() p.setColor(QPalette::Active, QPalette::Text, newState == Invalid ? d->m_errorTextColor : d->m_okTextColor); p.setColor(QPalette::Active, QPalette::PlaceholderText, - validates ? d->m_placeholderTextColor : d->m_errorTextColor); + validates || !d->m_validatePlaceHolder + ? d->m_placeholderTextColor : d->m_errorTextColor); setPalette(p); if (validHasChanged) diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h index 6ec0f6d33d4..eb54bc8d866 100644 --- a/src/libs/utils/fancylineedit.h +++ b/src/libs/utils/fancylineedit.h @@ -105,6 +105,8 @@ public: bool isValid() const; QString errorMessage() const; + void setValidatePlaceHolder(bool on); + void setValidationFunction(const ValidationFunction &fn); static ValidationFunction defaultValidationFunction(); void validate(); diff --git a/src/libs/utils/filestreamermanager.cpp b/src/libs/utils/filestreamermanager.cpp index 11d05faee57..33df7b264ea 100644 --- a/src/libs/utils/filestreamermanager.cpp +++ b/src/libs/utils/filestreamermanager.cpp @@ -132,7 +132,7 @@ FileStreamHandle FileStreamerManager::copy(const FilePath &source, const FilePat if (streamer->result() == StreamResult::FinishedWithSuccess) cont({}); else - cont(make_unexpected(Tr::tr("Failed copying file"))); + cont(make_unexpected(Tr::tr("Failed copying file."))); }; return execute(onSetup, onDone, context); } @@ -156,7 +156,7 @@ FileStreamHandle FileStreamerManager::read(const FilePath &source, QObject *cont if (streamer->result() == StreamResult::FinishedWithSuccess) cont(streamer->readData()); else - cont(make_unexpected(Tr::tr("Failed reading file"))); + cont(make_unexpected(Tr::tr("Failed reading file."))); }; return execute(onSetup, onDone, context); } @@ -182,7 +182,7 @@ FileStreamHandle FileStreamerManager::write(const FilePath &destination, const Q if (streamer->result() == StreamResult::FinishedWithSuccess) cont(0); // TODO: return write count? else - cont(make_unexpected(Tr::tr("Failed writing file"))); + cont(make_unexpected(Tr::tr("Failed writing file."))); }; return execute(onSetup, onDone, context); } diff --git a/src/libs/utils/mimetypes2/mimetype.cpp b/src/libs/utils/mimetypes2/mimetype.cpp index eadfb9e53c7..926ca6d950f 100644 --- a/src/libs/utils/mimetypes2/mimetype.cpp +++ b/src/libs/utils/mimetypes2/mimetype.cpp @@ -516,9 +516,6 @@ void MimeType::setPreferredSuffix(const QString &suffix) d->globPatterns.prepend(QLatin1String("*.") + suffix); } -} // namespace Utils - -#ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug debug, const Utils::MimeType &mime) { QDebugStateSaver saver(debug); @@ -529,6 +526,8 @@ QDebug operator<<(QDebug debug, const Utils::MimeType &mime) } return debug; } -#endif + +} // namespace Utils + #include "moc_mimetype.cpp" diff --git a/src/libs/utils/mimetypes2/mimetype.h b/src/libs/utils/mimetypes2/mimetype.h index 52587ff3aa4..ec28140d6ae 100644 --- a/src/libs/utils/mimetypes2/mimetype.h +++ b/src/libs/utils/mimetypes2/mimetype.h @@ -11,13 +11,15 @@ #include #include +QT_BEGIN_NAMESPACE +class QDebug; +QT_END_NAMESPACE + namespace Utils { class MimeTypePrivate; class MimeType; -QTCREATOR_UTILS_EXPORT size_t qHash(const MimeType &key, size_t seed = 0) noexcept; - class QTCREATOR_UTILS_EXPORT MimeType { Q_GADGET @@ -89,18 +91,13 @@ protected: friend class MimeBinaryProvider; friend class MimeTypePrivate; friend QTCREATOR_UTILS_EXPORT size_t qHash(const MimeType &key, size_t seed) noexcept; + friend QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug debug, const MimeType &mime); QExplicitlySharedDataPointer d; }; - } // namespace Utils QT_BEGIN_NAMESPACE -#ifndef QT_NO_DEBUG_STREAM -class QDebug; -QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug debug, const Utils::MimeType &mime); -#endif - Q_DECLARE_SHARED(Utils::MimeType) QT_END_NAMESPACE diff --git a/src/libs/utils/process.cpp b/src/libs/utils/process.cpp index 60efd93c586..43d57ded891 100644 --- a/src/libs/utils/process.cpp +++ b/src/libs/utils/process.cpp @@ -345,6 +345,23 @@ public: void doDefaultStart(const QString &program, const QStringList &arguments) final { + QString executable = program; + FilePath path = FilePath::fromUserInput(executable); + if (!path.isAbsolutePath()) { + path = path.searchInPath(); + if (path.isEmpty()) { + const ProcessResultData result + = {0, + QProcess::CrashExit, + QProcess::FailedToStart, + Tr::tr("The program \"%1\" could not be found.").arg(program)}; + emit done(result); + return; + } + + executable = path.nativePath(); + } + QTC_CHECK(m_setup.m_ptyData); m_setup.m_ptyData->setResizeHandler([this](const QSize &size) { if (m_ptyProcess) @@ -365,15 +382,15 @@ public: penv = Environment::systemEnvironment().toProcessEnvironment(); const QStringList senv = penv.toStringList(); - bool startResult - = m_ptyProcess->startProcess(program, - HostOsInfo::isWindowsHost() - ? QStringList{m_setup.m_nativeArguments} << arguments - : arguments, - m_setup.m_workingDirectory.nativePath(), - senv, - m_setup.m_ptyData->size().width(), - m_setup.m_ptyData->size().height()); + bool startResult = m_ptyProcess->startProcess(executable, + HostOsInfo::isWindowsHost() + ? QStringList{m_setup.m_nativeArguments} + << arguments + : arguments, + m_setup.m_workingDirectory.nativePath(), + senv, + m_setup.m_ptyData->size().width(), + m_setup.m_ptyData->size().height()); if (!startResult) { const ProcessResultData result = {-1, diff --git a/src/libs/utils/terminalinterface.cpp b/src/libs/utils/terminalinterface.cpp index 7046d7855ca..9b6e6457102 100644 --- a/src/libs/utils/terminalinterface.cpp +++ b/src/libs/utils/terminalinterface.cpp @@ -183,6 +183,8 @@ void TerminalInterface::onStubReadyRead() emitFinished(out.mid(5).toInt(), QProcess::NormalExit); } else if (out.startsWith("crash ")) { emitFinished(out.mid(6).toInt(), QProcess::CrashExit); + } else if (out.startsWith("ack ")) { + qCDebug(terminalInterfaceLog) << "Received ack from stub: " << out; } else { emitError(QProcess::UnknownError, msgUnexpectedOutput(out)); break; diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp index cb7de5307e5..9c6a616abe3 100644 --- a/src/plugins/android/androidmanifesteditorwidget.cpp +++ b/src/plugins/android/androidmanifesteditorwidget.cpp @@ -488,40 +488,21 @@ void AndroidManifestEditorWidget::focusInEvent(QFocusEvent *event) } } -static bool checkDocument(const QDomDocument &doc, QDomDocument::ParseResult *result) -{ - QDomElement manifest = doc.documentElement(); - if (manifest.tagName() != QLatin1String("manifest")) { - result->errorMessage = ::Android::Tr::tr("The structure of the Android manifest file " - "is corrupted. Expected a top level 'manifest' node."); - result->errorLine = -1; - result->errorColumn = -1; - return false; - } - if (manifest.firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).isNull()) { - // missing either application or activity element - result->errorMessage = ::Android::Tr::tr("The structure of the Android manifest file " - "is corrupted. Expected an 'application' and 'activity' sub node."); - result->errorLine = -1; - result->errorColumn = -1; - return false; - } - return true; -} - void AndroidManifestEditorWidget::updateAfterFileLoad() { + QString error; + int errorLine; + int errorColumn; QDomDocument doc; - QDomDocument::ParseResult result = doc.setContent(m_textEditorWidget->toPlainText()); - if (result) { - if (checkDocument(doc, &result)) { + if (doc.setContent(m_textEditorWidget->toPlainText(), &error, &errorLine, &errorColumn)) { + if (checkDocument(doc, &error, &errorLine, &errorColumn)) { if (activePage() != Source) syncToWidgets(doc); return; } } // some error occurred - updateInfoBar(result.errorMessage, result.errorLine, result.errorColumn); + updateInfoBar(error, errorLine, errorColumn); setActivePage(Source); } @@ -610,19 +591,39 @@ TextEditor::TextEditorWidget *AndroidManifestEditorWidget::textEditorWidget() co bool AndroidManifestEditorWidget::syncToWidgets() { QDomDocument doc; - QDomDocument::ParseResult result = doc.setContent(m_textEditorWidget->toPlainText()); - if (result) { - if (checkDocument(doc, &result)) { + QString errorMessage; + int errorLine, errorColumn; + if (doc.setContent(m_textEditorWidget->toPlainText(), &errorMessage, &errorLine, &errorColumn)) { + if (checkDocument(doc, &errorMessage, &errorLine, &errorColumn)) { hideInfoBar(); syncToWidgets(doc); return true; } } - updateInfoBar(result.errorMessage, result.errorLine, result.errorColumn); + updateInfoBar(errorMessage, errorLine, errorColumn); return false; } +bool AndroidManifestEditorWidget::checkDocument(const QDomDocument &doc, QString *errorMessage, + int *errorLine, int *errorColumn) +{ + QDomElement manifest = doc.documentElement(); + if (manifest.tagName() != QLatin1String("manifest")) { + *errorMessage = ::Android::Tr::tr("The structure of the Android manifest file is corrupted. Expected a top level 'manifest' node."); + *errorLine = -1; + *errorColumn = -1; + return false; + } else if (manifest.firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).isNull()) { + // missing either application or activity element + *errorMessage = ::Android::Tr::tr("The structure of the Android manifest file is corrupted. Expected an 'application' and 'activity' sub node."); + *errorLine = -1; + *errorColumn = -1; + return false; + } + return true; +} + void AndroidManifestEditorWidget::startParseCheck() { m_timerParseCheck.start(); @@ -640,15 +641,16 @@ void AndroidManifestEditorWidget::updateInfoBar() return; } QDomDocument doc; - QDomDocument::ParseResult result = doc.setContent(m_textEditorWidget->toPlainText()); - if (result) { - if (checkDocument(doc, &result)) { + int errorLine, errorColumn; + QString errorMessage; + if (doc.setContent(m_textEditorWidget->toPlainText(), &errorMessage, &errorLine, &errorColumn)) { + if (checkDocument(doc, &errorMessage, &errorLine, &errorColumn)) { hideInfoBar(); return; } } - updateInfoBar(result.errorMessage, result.errorLine, result.errorColumn); + updateInfoBar(errorMessage, errorLine, errorColumn); } void AndroidManifestEditorWidget::updateSdkVersions() @@ -886,9 +888,9 @@ void AndroidManifestEditorWidget::syncToEditor() m_dirty = false; } -static QXmlStreamAttributes modifyXmlStreamAttributes( - const QXmlStreamAttributes &input, const QStringList &keys, - const QStringList &values, const QStringList &remove = {}) +namespace { +QXmlStreamAttributes modifyXmlStreamAttributes(const QXmlStreamAttributes &input, const QStringList &keys, + const QStringList &values, const QStringList &remove = QStringList()) { Q_ASSERT(keys.size() == values.size()); QXmlStreamAttributes result; @@ -901,7 +903,8 @@ static QXmlStreamAttributes modifyXmlStreamAttributes( if (index == -1) result.push_back(attribute); else - result.push_back(QXmlStreamAttribute(name, values.at(index))); + result.push_back(QXmlStreamAttribute(name, + values.at(index))); } for (int i = 0; i < keys.size(); ++i) { @@ -910,6 +913,7 @@ static QXmlStreamAttributes modifyXmlStreamAttributes( } return result; } +} // end namespace void AndroidManifestEditorWidget::parseManifest(QXmlStreamReader &reader, QXmlStreamWriter &writer) { diff --git a/src/plugins/android/androidmanifesteditorwidget.h b/src/plugins/android/androidmanifesteditorwidget.h index 28c193f15fc..1cce7157e44 100644 --- a/src/plugins/android/androidmanifesteditorwidget.h +++ b/src/plugins/android/androidmanifesteditorwidget.h @@ -14,11 +14,14 @@ QT_BEGIN_NAMESPACE class QCheckBox; class QDomDocument; +class QDomElement; class QComboBox; class QPushButton; class QLabel; class QLineEdit; class QListView; +class QSpinBox; +class QToolButton; class QXmlStreamReader; class QXmlStreamWriter; QT_END_NAMESPACE @@ -105,6 +108,9 @@ private: void syncToEditor(); void updateAfterFileLoad(); + bool checkDocument(const QDomDocument &doc, QString *errorMessage, + int *errorLine, int *errorColumn); + void updateInfoBar(const QString &errorMessage, int line, int column); void hideInfoBar(); diff --git a/src/plugins/beautifier/abstractsettings.cpp b/src/plugins/beautifier/abstractsettings.cpp index 1b4ff3aa10e..362a2481538 100644 --- a/src/plugins/beautifier/abstractsettings.cpp +++ b/src/plugins/beautifier/abstractsettings.cpp @@ -88,9 +88,10 @@ AbstractSettings::AbstractSettings(const QString &name, const QString &ending) setSettingsGroups(Utils::Constants::BEAUTIFIER_SETTINGS_GROUP, name); command.setSettingsKey("command"); - command.setExpectedKind(Utils::PathChooser::ExistingCommand); + command.setExpectedKind(PathChooser::ExistingCommand); command.setCommandVersionArguments({"--version"}); command.setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle("Clang Format")); + command.setValidatePlaceHolder(true); supportedMimeTypes.setDisplayStyle(StringAspect::LineEditDisplay); supportedMimeTypes.setSettingsKey("supportedMime"); diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp index a44d5308304..92dd9aea4d5 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.cpp +++ b/src/plugins/clangformat/clangformatbaseindenter.cpp @@ -7,15 +7,16 @@ #include +#include + #include #include #include #include +#include #include -#include - #include #include #include @@ -24,6 +25,8 @@ #include #include +#include + namespace ClangFormat { Internal::LlvmFileSystemAdapter llvmFileSystemAdapter = {}; @@ -760,7 +763,7 @@ clang::format::FormatStyle overrideStyle(const Utils::FilePath &fileName) Utils::FilePath filePath = filePathToCurrentSettings(preferences); if (!filePath.exists()) - return qtcStyle(); + return currentQtStyle(preferences); clang::format::FormatStyle currentSettingsStyle; currentSettingsStyle.Language = clang::format::FormatStyle::LK_Cpp; @@ -769,7 +772,7 @@ clang::format::FormatStyle overrideStyle(const Utils::FilePath &fileName) .toStdString(), ¤tSettingsStyle); QTC_ASSERT(error.value() == static_cast(clang::format::ParseError::Success), - return qtcStyle()); + return currentQtStyle(preferences)); return currentSettingsStyle; } diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp index cfc25544e57..7c5b8ac3369 100644 --- a/src/plugins/clangformat/clangformatconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatconfigwidget.cpp @@ -80,7 +80,7 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(TextEditor::ICodeStylePreferenc : CppCodeStyleWidget(parent), d(new Private) { d->project = project; - d->config = std::make_unique(filePathToCurrentSettings(codeStyle->currentPreferences())); + d->config = std::make_unique(codeStyle->currentPreferences()); d->fallbackConfig = new QLabel(Tr::tr("Clang-Format Style")); d->checksScrollArea = new QScrollArea(); @@ -136,7 +136,7 @@ void ClangFormatConfigWidget::slotCodeStyleChanged( { if (!codeStyle) return; - d->config.reset(new ClangFormatFile(filePathToCurrentSettings(codeStyle))); + d->config.reset(new ClangFormatFile(codeStyle)); d->config->setIsReadOnly(codeStyle->isReadOnly()); d->style = d->config->style(); diff --git a/src/plugins/clangformat/clangformatfile.cpp b/src/plugins/clangformat/clangformatfile.cpp index fc1659b976c..16209c30943 100644 --- a/src/plugins/clangformat/clangformatfile.cpp +++ b/src/plugins/clangformat/clangformatfile.cpp @@ -4,17 +4,23 @@ #include "clangformatfile.h" #include "clangformatsettings.h" #include "clangformatutils.h" + +#include #include + #include + +#include #include + #include #include using namespace ClangFormat; -ClangFormatFile::ClangFormatFile(Utils::FilePath filePath) - : m_filePath(filePath) +ClangFormatFile::ClangFormatFile(const TextEditor::ICodeStylePreferences *preferences) + : m_filePath(filePathToCurrentSettings(preferences)) { if (!m_filePath.exists()) { // create file and folder @@ -23,7 +29,7 @@ ClangFormatFile::ClangFormatFile(Utils::FilePath filePath) if (newStyleFile.is_open()) { newStyleFile.close(); } - resetStyleToQtC(); + resetStyleToQtC(preferences); return; } @@ -33,7 +39,7 @@ ClangFormatFile::ClangFormatFile(Utils::FilePath filePath) .toStdString(), &m_style); if (error.value() != static_cast(clang::format::ParseError::Success)) { - resetStyleToQtC(); + resetStyleToQtC(preferences); } } @@ -62,9 +68,9 @@ void ClangFormatFile::setIsReadOnly(bool isReadOnly) m_isReadOnly = isReadOnly; } -void ClangFormatFile::resetStyleToQtC() +void ClangFormatFile::resetStyleToQtC(const TextEditor::ICodeStylePreferences *preferences) { - m_style = qtcStyle(); + m_style = currentQtStyle(preferences); saveStyleToFile(m_style, m_filePath); } @@ -178,48 +184,7 @@ CppEditor::CppCodeStyleSettings ClangFormatFile::toCppCodeStyleSettings( void ClangFormatFile::fromCppCodeStyleSettings(const CppEditor::CppCodeStyleSettings &settings) { - using namespace clang::format; - if (settings.indentAccessSpecifiers) - m_style.AccessModifierOffset = 0; - else - m_style.AccessModifierOffset = -1 * m_style.IndentWidth; - - if (settings.indentNamespaceBody || settings.indentNamespaceBraces) - m_style.NamespaceIndentation = FormatStyle::NamespaceIndentationKind::NI_All; - else - m_style.NamespaceIndentation = FormatStyle::NamespaceIndentationKind::NI_None; - - if (settings.indentClassBraces || settings.indentEnumBraces || settings.indentBlockBraces - || settings.indentFunctionBraces) - m_style.BreakBeforeBraces = FormatStyle::BS_Whitesmiths; - else - m_style.BreakBeforeBraces = FormatStyle::BS_Custom; - - - m_style.IndentCaseLabels = settings.indentSwitchLabels; -#if LLVM_VERSION_MAJOR >= 11 - m_style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels; -#endif - - if (settings.extraPaddingForConditionsIfConfusingAlign) - m_style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; - else if (settings.alignAssignments) - m_style.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment; - else - m_style.BreakBeforeBinaryOperators = FormatStyle::BOS_None; - - m_style.DerivePointerAlignment = settings.bindStarToIdentifier || settings.bindStarToTypeName - || settings.bindStarToLeftSpecifier - || settings.bindStarToRightSpecifier; - - if ((settings.bindStarToIdentifier || settings.bindStarToRightSpecifier) - && ClangFormatSettings::instance().mode() == ClangFormatSettings::Mode::Formatting) - m_style.PointerAlignment = FormatStyle::PAS_Right; - - if ((settings.bindStarToTypeName || settings.bindStarToLeftSpecifier) - && ClangFormatSettings::instance().mode() == ClangFormatSettings::Mode::Formatting) - m_style.PointerAlignment = FormatStyle::PAS_Left; - + ::fromCppCodeStyleSettings(m_style, settings); saveNewFormat(); } @@ -258,22 +223,6 @@ TextEditor::TabSettings ClangFormatFile::toTabSettings(ProjectExplorer::Project void ClangFormatFile::fromTabSettings(const TextEditor::TabSettings &settings) { - using namespace clang::format; - - m_style.IndentWidth = settings.m_indentSize; - m_style.TabWidth = settings.m_tabSize; - - switch (settings.m_tabPolicy) { - case TextEditor::TabSettings::TabPolicy::MixedTabPolicy: - m_style.UseTab = FormatStyle::UT_ForContinuationAndIndentation; - break; - case TextEditor::TabSettings::TabPolicy::SpacesOnlyTabPolicy: - m_style.UseTab = FormatStyle::UT_Never; - break; - case TextEditor::TabSettings::TabPolicy::TabsOnlyTabPolicy: - m_style.UseTab = FormatStyle::UT_Always; - break; - } - + ::fromTabSettings(m_style, settings); saveNewFormat(); } diff --git a/src/plugins/clangformat/clangformatfile.h b/src/plugins/clangformat/clangformatfile.h index dcd0e0d6c10..ad32952b0f0 100644 --- a/src/plugins/clangformat/clangformatfile.h +++ b/src/plugins/clangformat/clangformatfile.h @@ -9,18 +9,21 @@ namespace CppEditor { class CppCodeStyleSettings; } namespace ProjectExplorer { class Project; } -namespace TextEditor { class TabSettings; } +namespace TextEditor { +class ICodeStylePreferences; +class TabSettings; +} namespace ClangFormat { class ClangFormatFile { public: - explicit ClangFormatFile(Utils::FilePath file); + explicit ClangFormatFile(const TextEditor::ICodeStylePreferences *preferences); clang::format::FormatStyle style(); Utils::FilePath filePath(); - void resetStyleToQtC(); + void resetStyleToQtC(const TextEditor::ICodeStylePreferences *codeStyle); void setBasedOnStyle(QString styleName); void setStyle(clang::format::FormatStyle style); QString setStyle(QString style); diff --git a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp index d8533f268c7..bbca4c94007 100644 --- a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp @@ -205,15 +205,15 @@ void ClangFormatGlobalConfigWidget::initOverrideCheckBox() connect(m_indentingOrFormatting, &QComboBox::currentIndexChanged, this, setEnableOverrideCheckBox); - m_overrideDefault->setToolTip(Tr::tr( - "When this option is enabled, ClangFormat will use a\n" - "user-specified configuration from the widget below,\n" - "instead of the project .clang-format file. You can\n" - "customize the formatting options for your code by\n" - "adjusting the settings in the widget. Note that any\n" - "changes made there will only affect the current\n" - "configuration, and will not modify the project\n" - ".clang-format file.")); + m_overrideDefault->setToolTip("" + + Tr::tr("When this option is enabled, ClangFormat will use a " + "user-specified configuration from the widget below, " + "instead of the project .clang-format file. You can " + "customize the formatting options for your code by " + "adjusting the settings in the widget. Note that any " + "changes made there will only affect the current " + "configuration, and will not modify the project " + ".clang-format file.")); m_overrideDefault->setChecked(getProjectOverriddenSettings(m_project)); setTemporarilyReadOnly(); diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp index 1e3e1a72e33..949911fe5e0 100644 --- a/src/plugins/clangformat/clangformatutils.cpp +++ b/src/plugins/clangformat/clangformatutils.cpp @@ -7,6 +7,7 @@ #include +#include #include #include @@ -185,6 +186,83 @@ clang::format::FormatStyle qtcStyle() return style; } +clang::format::FormatStyle currentQtStyle(const TextEditor::ICodeStylePreferences *preferences) +{ + clang::format::FormatStyle style = qtcStyle(); + if (!preferences) + return style; + + fromTabSettings(style, preferences->tabSettings()); + if (auto ccpPreferences = dynamic_cast(preferences)) + fromCppCodeStyleSettings(style, ccpPreferences->codeStyleSettings()); + return style; +} + +void fromCppCodeStyleSettings(clang::format::FormatStyle &style, + const CppEditor::CppCodeStyleSettings &settings) +{ + using namespace clang::format; + if (settings.indentAccessSpecifiers) + style.AccessModifierOffset = 0; + else + style.AccessModifierOffset = -1 * style.IndentWidth; + + if (settings.indentNamespaceBody || settings.indentNamespaceBraces) + style.NamespaceIndentation = FormatStyle::NamespaceIndentationKind::NI_All; + else + style.NamespaceIndentation = FormatStyle::NamespaceIndentationKind::NI_None; + + if (settings.indentClassBraces || settings.indentEnumBraces || settings.indentBlockBraces + || settings.indentFunctionBraces) + style.BreakBeforeBraces = FormatStyle::BS_Whitesmiths; + else + style.BreakBeforeBraces = FormatStyle::BS_Custom; + + style.IndentCaseLabels = settings.indentSwitchLabels; +#if LLVM_VERSION_MAJOR >= 11 + style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels; +#endif + + if (settings.extraPaddingForConditionsIfConfusingAlign) + style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; + else if (settings.alignAssignments) + style.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment; + else + style.BreakBeforeBinaryOperators = FormatStyle::BOS_None; + + style.DerivePointerAlignment = settings.bindStarToIdentifier || settings.bindStarToTypeName + || settings.bindStarToLeftSpecifier + || settings.bindStarToRightSpecifier; + + if ((settings.bindStarToIdentifier || settings.bindStarToRightSpecifier) + && ClangFormatSettings::instance().mode() == ClangFormatSettings::Mode::Formatting) + style.PointerAlignment = FormatStyle::PAS_Right; + + if ((settings.bindStarToTypeName || settings.bindStarToLeftSpecifier) + && ClangFormatSettings::instance().mode() == ClangFormatSettings::Mode::Formatting) + style.PointerAlignment = FormatStyle::PAS_Left; +} + +void fromTabSettings(clang::format::FormatStyle &style, const TextEditor::TabSettings &settings) +{ + using namespace clang::format; + + style.IndentWidth = settings.m_indentSize; + style.TabWidth = settings.m_tabSize; + + switch (settings.m_tabPolicy) { + case TextEditor::TabSettings::TabPolicy::MixedTabPolicy: + style.UseTab = FormatStyle::UT_ForContinuationAndIndentation; + break; + case TextEditor::TabSettings::TabPolicy::SpacesOnlyTabPolicy: + style.UseTab = FormatStyle::UT_Never; + break; + case TextEditor::TabSettings::TabPolicy::TabsOnlyTabPolicy: + style.UseTab = FormatStyle::UT_Always; + break; + } +} + QString projectUniqueId(ProjectExplorer::Project *project) { if (!project) diff --git a/src/plugins/clangformat/clangformatutils.h b/src/plugins/clangformat/clangformatutils.h index f7d67e7dc83..931ca087fae 100644 --- a/src/plugins/clangformat/clangformatutils.h +++ b/src/plugins/clangformat/clangformatutils.h @@ -14,8 +14,12 @@ #include -namespace TextEditor { class ICodeStylePreferences; } +namespace TextEditor { +class ICodeStylePreferences; +class TabSettings; +} namespace ProjectExplorer { class Project; } +namespace CppEditor { class CppCodeStyleSettings; } namespace ClangFormat { QString projectUniqueId(ProjectExplorer::Project *project); @@ -32,10 +36,15 @@ ClangFormatSettings::Mode getCurrentIndentationOrFormattingSettings(const Utils: Utils::FilePath configForFile(const Utils::FilePath &fileName); Utils::FilePath findConfig(const Utils::FilePath &fileName); +void fromTabSettings(clang::format::FormatStyle &style, const TextEditor::TabSettings &settings); +void fromCppCodeStyleSettings(clang::format::FormatStyle &style, + const CppEditor::CppCodeStyleSettings &settings); + bool getProjectOverriddenSettings(const ProjectExplorer::Project *project); void addQtcStatementMacros(clang::format::FormatStyle &style); clang::format::FormatStyle qtcStyle(); +clang::format::FormatStyle currentQtStyle(const TextEditor::ICodeStylePreferences *codeStyle); Utils::FilePath filePathToCurrentSettings(const TextEditor::ICodeStylePreferences *codeStyle); } diff --git a/src/plugins/clangtools/documentclangtoolrunner.cpp b/src/plugins/clangtools/documentclangtoolrunner.cpp index 8dab531dcb6..5640411e7cf 100644 --- a/src/plugins/clangtools/documentclangtoolrunner.cpp +++ b/src/plugins/clangtools/documentclangtoolrunner.cpp @@ -83,9 +83,7 @@ static void removeClangToolRefactorMarkers(TextEditor::TextEditorWidget *editor) { if (!editor) return; - editor->setRefactorMarkers( - TextEditor::RefactorMarker::filterOutType(editor->refactorMarkers(), - Constants::CLANG_TOOL_FIXIT_AVAILABLE_MARKER_ID)); + editor->clearRefactorMarkers(Constants::CLANG_TOOL_FIXIT_AVAILABLE_MARKER_ID); } void DocumentClangToolRunner::scheduleRun() @@ -291,7 +289,7 @@ void DocumentClangToolRunner::onDone(const AnalyzeOutputData &output) for (auto editor : TextEditor::BaseTextEditor::textEditorsForDocument(doc)) { if (TextEditor::TextEditorWidget *widget = editor->editorWidget()) { - widget->setRefactorMarkers(markers + widget->refactorMarkers()); + widget->setRefactorMarkers(markers, Constants::CLANG_TOOL_FIXIT_AVAILABLE_MARKER_ID); if (!m_editorsWithMarkers.contains(widget)) m_editorsWithMarkers << widget; } diff --git a/src/plugins/cmakeprojectmanager/cmakeautocompleter.cpp b/src/plugins/cmakeprojectmanager/cmakeautocompleter.cpp index 6e5b482a70a..1f520a86bf5 100644 --- a/src/plugins/cmakeprojectmanager/cmakeautocompleter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeautocompleter.cpp @@ -89,7 +89,7 @@ QString CMakeAutoCompleter::insertMatchingQuote(const QTextCursor &cursor, int CMakeAutoCompleter::paragraphSeparatorAboutToBeInserted(QTextCursor &cursor) { const QString line = cursor.block().text().trimmed(); - if (line.contains(QRegularExpression(QStringLiteral("^(endfunction|endmacro|endif|endforeach|endwhile)\\w*\\(")))) + if (line.contains(QRegularExpression(QStringLiteral("^(endfunction|endmacro|endif|endforeach|endwhile|endblock)\\w*\\(")))) tabSettings().indentLine(cursor.block(), tabSettings().indentationColumn(cursor.block().text())); return 0; } diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 1bd19dffeb1..9abb3597d15 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -175,8 +175,8 @@ void CMakeBuildSystem::triggerParsing() qCDebug(cmakeBuildSystemLog) << "Parse called with flags:" << reparseParametersString(reparseParameters); - const QString cache = m_parameters.buildDirectory.pathAppended("CMakeCache.txt").toString(); - if (!QFileInfo::exists(cache)) { + const FilePath cache = m_parameters.buildDirectory.pathAppended("CMakeCache.txt"); + if (!cache.exists()) { reparseParameters |= REPARSE_FORCE_INITIAL_CONFIGURATION | REPARSE_FORCE_CMAKE_RUN; qCDebug(cmakeBuildSystemLog) << "No" << cache diff --git a/src/plugins/cmakeprojectmanager/cmakeindenter.cpp b/src/plugins/cmakeprojectmanager/cmakeindenter.cpp index 68157aea5bf..e3e88212c57 100644 --- a/src/plugins/cmakeprojectmanager/cmakeindenter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeindenter.cpp @@ -52,7 +52,8 @@ static bool lineStartsBlock(const QString &line) lineContainsFunction(line, QStringLiteral("while")) || lineContainsFunction(line, QStringLiteral("if")) || lineContainsFunction(line, QStringLiteral("elseif")) || - lineContainsFunction(line, QStringLiteral("else")); + lineContainsFunction(line, QStringLiteral("else")) || + lineContainsFunction(line, QStringLiteral("block")); } static bool lineEndsBlock(const QString &line) { @@ -62,7 +63,8 @@ static bool lineEndsBlock(const QString &line) lineContainsFunction(line, QStringLiteral("endwhile")) || lineContainsFunction(line, QStringLiteral("endif")) || lineContainsFunction(line, QStringLiteral("elseif")) || - lineContainsFunction(line, QStringLiteral("else")); + lineContainsFunction(line, QStringLiteral("else")) || + lineContainsFunction(line, QStringLiteral("endblock")); } static bool lineIsEmpty(const QString &line) { diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 78b6449a7a9..44ebaff555e 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -115,7 +115,16 @@ Internal::PresetsData CMakeProject::combinePresets(Internal::PresetsData &cmakeP && left.inherits.value() == right.inherits.value(); const bool leftInheritsRight = left.inherits && left.inherits.value().contains(right.name); - if ((left.inherits && !right.inherits) || leftInheritsRight || sameInheritance) + + const bool inheritsGreater = left.inherits && right.inherits + && left.inherits.value().first() + > right.inherits.value().first(); + + const bool noInheritsGreater = !left.inherits && !right.inherits + && left.name > right.name; + + if ((left.inherits && !right.inherits) || leftInheritsRight || sameInheritance + || inheritsGreater || noInheritsGreater) return false; return true; }); diff --git a/src/plugins/copilot/copilotclient.cpp b/src/plugins/copilot/copilotclient.cpp index f935210b53d..790596a3c29 100644 --- a/src/plugins/copilot/copilotclient.cpp +++ b/src/plugins/copilot/copilotclient.cpp @@ -180,7 +180,11 @@ void CopilotClient::handleCompletions(const GetCompletionRequest::Response &resp return; if (const std::optional result = response.result()) { - QList completions = result->completions().toListOrEmpty(); + auto isValidCompletion = [](const Completion &completion) { + return completion.isValid() && !completion.text().trimmed().isEmpty(); + }; + const QList completions = Utils::filtered(result->completions().toListOrEmpty(), + isValidCompletion); if (completions.isEmpty()) return; editor->insertSuggestion( diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp index edc65f76526..a6daf681db5 100644 --- a/src/plugins/cppeditor/cppeditorwidget.cpp +++ b/src/plugins/cppeditor/cppeditorwidget.cpp @@ -590,8 +590,7 @@ void CppEditorWidget::onCodeWarningsUpdated(unsigned revision, setExtraSelections(TextEditorWidget::CodeWarningsSelection, unselectLeadingWhitespace(selections)); - setRefactorMarkers(refactorMarkers + RefactorMarker::filterOutType( - this->refactorMarkers(), Constants::CPP_CLANG_FIXIT_AVAILABLE_MARKER_ID)); + setRefactorMarkers(refactorMarkers, Constants::CPP_CLANG_FIXIT_AVAILABLE_MARKER_ID); } void CppEditorWidget::onIfdefedOutBlocksUpdated(unsigned revision, diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index b43e87758e2..aa17721ea37 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -279,8 +279,7 @@ void FunctionDeclDefLink::hideMarker(CppEditorWidget *editor) { if (!hasMarker) return; - editor->setRefactorMarkers(RefactorMarker::filterOutType( - editor->refactorMarkers(), Constants::CPP_FUNCTION_DECL_DEF_LINK_MARKER_ID)); + editor->clearRefactorMarkers(Constants::CPP_FUNCTION_DECL_DEF_LINK_MARKER_ID); hasMarker = false; } @@ -289,8 +288,7 @@ void FunctionDeclDefLink::showMarker(CppEditorWidget *editor) if (hasMarker) return; - QList markers = RefactorMarker::filterOutType( - editor->refactorMarkers(), Constants::CPP_FUNCTION_DECL_DEF_LINK_MARKER_ID); + RefactorMarkers markers; RefactorMarker marker; // show the marker at the end of the linked area, with a special case @@ -321,7 +319,7 @@ void FunctionDeclDefLink::showMarker(CppEditorWidget *editor) cppEditor->applyDeclDefLinkChanges(true); }; markers += marker; - editor->setRefactorMarkers(markers); + editor->setRefactorMarkers(markers, Constants::CPP_FUNCTION_DECL_DEF_LINK_MARKER_ID); hasMarker = true; } diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index c60052452a8..28d90c747cf 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -2289,9 +2289,9 @@ void CdbEngine::parseOutputLine(QString line) CheckableMessageBox::information( Core::ICore::dialogParent(), Tr::tr("Debugger Start Failed"), - Tr::tr("The system prevents loading of %1, which is required for debugging. " + Tr::tr("The system prevents loading of \"%1\", which is required for debugging. " "Make sure that your antivirus solution is up to date and if that does not work " - "consider adding an exception for %1.") + "consider adding an exception for \"%1\".") .arg(m_extensionFileName), QString("SecureInfoCdbextCannotBeLoaded")); notifyEngineSetupFailed(); @@ -2778,7 +2778,7 @@ void CdbEngine::setupScripting(const DebuggerResponse &response) if (!toLoad) { Core::AsynchronousMessageBox::critical( Tr::tr("Cannot Find Debugger Initialization Script"), - Tr::tr("Cannot read %1: %2").arg(loadOrderFile.toUserOutput(), toLoad.error())); + Tr::tr("Cannot read \"%1\": %2").arg(loadOrderFile.toUserOutput(), toLoad.error())); notifyEngineSetupFailed(); return; } @@ -2795,7 +2795,8 @@ void CdbEngine::setupScripting(const DebuggerResponse &response) const FilePath codeFile = dumperPath / (module + ".py"); const expected_str code = codeFile.fileContents(); if (!code) { - qDebug() << Tr::tr("Cannot read %1: %2").arg(codeFile.toUserOutput(), code.error()); + qDebug() << Tr::tr("Cannot read \"%1\": %2") + .arg(codeFile.toUserOutput(), code.error()); continue; } diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index aca5a976359..2c97bdc8456 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -221,7 +221,7 @@ DebuggerItemModel::DebuggerItemModel() genericGdb.setEngineType(GdbEngineType); genericGdb.setAbi(Abi()); genericGdb.setCommand("gdb"); - genericGdb.setUnexpandedDisplayName(Tr::tr("%1 from PATH on Build Device").arg("GDB")); + genericGdb.setUnexpandedDisplayName(Tr::tr("GDB from PATH on Build Device")); generic->appendChild(new DebuggerTreeItem(genericGdb, false)); DebuggerItem genericLldb(QVariant("lldb")); @@ -230,7 +230,7 @@ DebuggerItemModel::DebuggerItemModel() genericLldb.setGeneric(true); genericLldb.setAbi(Abi()); genericLldb.setCommand("lldb"); - genericLldb.setUnexpandedDisplayName(Tr::tr("%1 from PATH on Build Device").arg("LLDB")); + genericLldb.setUnexpandedDisplayName(Tr::tr("LLDB from PATH on Build Device")); generic->appendChild(new DebuggerTreeItem(genericLldb, false)); } diff --git a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp index 8c118f553b6..8cf92fe1da8 100644 --- a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp +++ b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp @@ -73,19 +73,19 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(Target *target) const auto setSummaryText = [this, details] { QStringList items; if (m_cppAspect->value() == TriState::Enabled) - items.append(Tr::tr("Enable C++ debugger")); + items.append(Tr::tr("Enable C++ debugger.")); else if (m_cppAspect->value() == TriState::Default) - items.append(Tr::tr("Try to determine need for C++ debugger")); + items.append(Tr::tr("Try to determine need for C++ debugger.")); if (m_qmlAspect->value() == TriState::Enabled) - items.append(Tr::tr("Enable QML debugger")); + items.append(Tr::tr("Enable QML debugger.")); else if (m_qmlAspect->value() == TriState::Default) - items.append(Tr::tr("Try to determine need for QML debugger")); + items.append(Tr::tr("Try to determine need for QML debugger.")); items.append(m_overrideStartupAspect->value().isEmpty() - ? Tr::tr("Without additional startup commands") - : Tr::tr("With additional startup commands")); - details->setSummaryText(items.join(". ")); + ? Tr::tr("Without additional startup commands.") + : Tr::tr("With additional startup commands.")); + details->setSummaryText(items.join(" ")); }; setSummaryText(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index e5052d1b89d..d52e2bc7104 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3976,9 +3976,9 @@ void GdbEngine::handleGdbStarted() const FilePath loadOrderFile = dumperPath / "loadorder.txt"; const expected_str toLoad = loadOrderFile.fileContents(); if (!toLoad) { - AsynchronousMessageBox::critical( - Tr::tr("Cannot Find Debugger Initialization Script"), - Tr::tr("Cannot read %1: %2").arg(loadOrderFile.toUserOutput(), toLoad.error())); + AsynchronousMessageBox::critical(Tr::tr("Cannot Find Debugger Initialization Script"), + Tr::tr("Cannot read \"%1\": %2") + .arg(loadOrderFile.toUserOutput(), toLoad.error())); notifyEngineSetupFailed(); return; } @@ -3995,7 +3995,8 @@ void GdbEngine::handleGdbStarted() const FilePath codeFile = dumperPath / (module + ".py"); const expected_str code = codeFile.fileContents(); if (!code) { - qDebug() << Tr::tr("Cannot read %1: %2").arg(codeFile.toUserOutput(), code.error()); + qDebug() << Tr::tr("Cannot read \"%1\": %2") + .arg(codeFile.toUserOutput(), code.error()); continue; } diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index c0ecaf4849f..6c7962088a7 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -879,7 +879,7 @@ static ConsoleItem *constructLogItemTree(const QVariant &result, item->appendChild(child); } - } else if (result.type() == QVariant::List) { + } else if (result.typeId() == QVariant::List) { if (key.isEmpty()) text = "List"; else @@ -1354,9 +1354,9 @@ void QmlEnginePrivate::scripts(int types, const QList ids, bool includeSour if (includeSource) cmd.arg(INCLUDESOURCE, includeSource); - if (filter.type() == QVariant::String) + if (filter.typeId() == QVariant::String) cmd.arg(FILTER, filter.toString()); - else if (filter.type() == QVariant::Int) + else if (filter.typeId() == QVariant::Int) cmd.arg(FILTER, filter.toInt()); else QTC_CHECK(!filter.isValid()); @@ -2039,7 +2039,7 @@ StackFrame QmlEnginePrivate::extractStackFrame(const QVariant &bodyVal) } auto extractString = [this](const QVariant &item) { - return ((item.type() == QVariant::String) ? item : extractData(item).value).toString(); + return (item.typeId() == QVariant::String ? item : extractData(item).value).toString(); }; stackFrame.function = extractString(body.value("func")); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 5324c7a8dcb..45a3277f702 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -2517,9 +2517,9 @@ void WatchModel::showEditValue(const WatchItem *item) else if (format == DisplayUtf8String) str = QString::fromUtf8(ba.constData(), ba.size()); else if (format == DisplayUtf16String) - str = QString::fromUtf16((ushort *)ba.constData(), ba.size() / 2); + str = QString::fromUtf16(reinterpret_cast(ba.constData()), ba.size() / 2); else if (format == DisplayUcs4String) - str = QString::fromUcs4((uint *)ba.constData(), ba.size() / 4); + str = QString::fromUcs4(reinterpret_cast(ba.constData()), ba.size() / 4); m_separatedView->prepareObject(item)->setPlainText(str); } else if (format == DisplayPlotData) { // Plots diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp index 6bf4914840a..607a200dc90 100644 --- a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp +++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp @@ -3,45 +3,48 @@ #include "genericbuildconfiguration.h" -#include "genericmakestep.h" #include "genericproject.h" #include "genericprojectconstants.h" #include "genericprojectmanagertr.h" #include #include -#include #include #include -#include #include #include -#include #include - using namespace ProjectExplorer; using namespace Utils; -namespace GenericProjectManager { -namespace Internal { +namespace GenericProjectManager::Internal { -GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, Utils::Id id) - : BuildConfiguration(parent, id) +class GenericBuildConfiguration final : public BuildConfiguration { - setConfigWidgetDisplayName(GenericProjectManager::Tr::tr("Generic Manager")); - setBuildDirectoryHistoryCompleter("Generic.BuildDir.History"); +public: + GenericBuildConfiguration(Target *target, Id id) + : BuildConfiguration(target, id) + { + setConfigWidgetDisplayName(GenericProjectManager::Tr::tr("Generic Manager")); + setBuildDirectoryHistoryCompleter("Generic.BuildDir.History"); + + setInitializer([this](const BuildInfo &) { + buildSteps()->appendStep(Constants::GENERIC_MS_ID); + cleanSteps()->appendStep(Constants::GENERIC_MS_ID); + updateCacheAndEmitEnvironmentChanged(); + }); - setInitializer([this](const BuildInfo &) { - buildSteps()->appendStep(Constants::GENERIC_MS_ID); - cleanSteps()->appendStep(Constants::GENERIC_MS_ID); updateCacheAndEmitEnvironmentChanged(); - }); + } - updateCacheAndEmitEnvironmentChanged(); -} + void addToEnvironment(Environment &env) const final + { + QtSupport::QtKitAspect::addHostBinariesToPath(kit(), env); + } +}; // GenericBuildConfigurationFactory @@ -68,10 +71,4 @@ GenericBuildConfigurationFactory::GenericBuildConfigurationFactory() }); } -void GenericBuildConfiguration::addToEnvironment(Utils::Environment &env) const -{ - QtSupport::QtKitAspect::addHostBinariesToPath(kit(), env); -} - -} // namespace Internal -} // namespace GenericProjectManager +} // GenericProjectManager::Internal diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.h b/src/plugins/genericprojectmanager/genericbuildconfiguration.h index 16d19a719ec..6fb8a3807b1 100644 --- a/src/plugins/genericprojectmanager/genericbuildconfiguration.h +++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.h @@ -5,18 +5,7 @@ #include -namespace GenericProjectManager { -namespace Internal { - -class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration -{ - Q_OBJECT - - friend class ProjectExplorer::BuildConfigurationFactory; - GenericBuildConfiguration(ProjectExplorer::Target *target, Utils::Id id); - - void addToEnvironment(Utils::Environment &env) const final; -}; +namespace GenericProjectManager::Internal { class GenericBuildConfigurationFactory final : public ProjectExplorer::BuildConfigurationFactory { @@ -24,5 +13,4 @@ public: GenericBuildConfigurationFactory(); }; -} // namespace Internal -} // namespace GenericProjectManager +} // GenericProjectManager::Internal diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index bb5a4594dc5..219a4547368 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -202,8 +202,7 @@ public: for (Core::IEditor *editor : editors) { if (auto textEditor = qobject_cast(editor)) { TextEditorWidget *widget = textEditor->editorWidget(); - widget->setRefactorMarkers( - RefactorMarker::filterOutType(widget->refactorMarkers(), m_id)); + widget->clearRefactorMarkers(m_id); widget->removeHoverHandler(&m_hoverHandler); } } @@ -910,8 +909,7 @@ void Client::deactivateDocument(TextEditor::TextDocument *document) TextEditor::TextEditorWidget *widget = textEditor->editorWidget(); widget->removeHoverHandler(&d->m_hoverHandler); widget->setExtraSelections(TextEditor::TextEditorWidget::CodeSemanticsSelection, {}); - widget->setRefactorMarkers( - TextEditor::RefactorMarker::filterOutType(widget->refactorMarkers(), id())); + widget->clearRefactorMarkers(id()); updateEditorToolBar(editor); } } @@ -1158,7 +1156,7 @@ void Client::documentContentsChanged(TextEditor::TextDocument *document, TextEditorWidget *widget = editor->editorWidget(); QTC_ASSERT(widget, continue); delete d->m_documentHighlightsTimer.take(widget); - widget->setRefactorMarkers(RefactorMarker::filterOutType(widget->refactorMarkers(), id())); + widget->clearRefactorMarkers(id()); } d->m_documentUpdateTimer.start(); } diff --git a/src/plugins/languageclient/languageclientsymbolsupport.cpp b/src/plugins/languageclient/languageclientsymbolsupport.cpp index 7069360b021..89cc9f44e2b 100644 --- a/src/plugins/languageclient/languageclientsymbolsupport.cpp +++ b/src/plugins/languageclient/languageclientsymbolsupport.cpp @@ -551,7 +551,7 @@ void SymbolSupport::handleRenameResponse(Core::SearchResult *search, if (error.has_value()) { errorMessage = error->toString(); if (errorMessage.contains("Cannot rename symbol: new name is the same as the old name")) - errorMessage = Tr::tr("Start typing to see replacements"); // clangd optimization + errorMessage = Tr::tr("Start typing to see replacements."); // clangd optimization else m_client->log(*error); } diff --git a/src/plugins/languageclient/languageclientutils.cpp b/src/plugins/languageclient/languageclientutils.cpp index c421b2a9376..06ed8dcae65 100644 --- a/src/plugins/languageclient/languageclientutils.cpp +++ b/src/plugins/languageclient/languageclientutils.cpp @@ -200,7 +200,7 @@ void updateCodeActionRefactoringMarker(Client *client, const RefactorMarkers markers = markersAtBlock.values(); for (BaseTextEditor *editor : editors) { if (TextEditorWidget *editorWidget = editor->editorWidget()) - editorWidget->setRefactorMarkers(markers + editorWidget->refactorMarkers()); + editorWidget->setRefactorMarkers(markers, client->id()); } } diff --git a/src/plugins/mesonprojectmanager/mesonbuildsettingswidget.cpp b/src/plugins/mesonprojectmanager/mesonbuildsettingswidget.cpp index 32719c08d61..26389d38883 100644 --- a/src/plugins/mesonprojectmanager/mesonbuildsettingswidget.cpp +++ b/src/plugins/mesonprojectmanager/mesonbuildsettingswidget.cpp @@ -49,8 +49,6 @@ MesonBuildSettingsWidget::MesonBuildSettingsWidget(MesonBuildConfiguration *buil auto parametersLineEdit = new QLineEdit; - auto buildDirWidget = new QWidget; - auto optionsFilterLineEdit = new FancyLineEdit; auto optionsTreeView = new TreeView; @@ -61,25 +59,22 @@ MesonBuildSettingsWidget::MesonBuildSettingsWidget(MesonBuildConfiguration *buil optionsTreeView->setSortingEnabled(true); using namespace Layouting; - Column { - Form { Tr::tr("Parameters"), parametersLineEdit, br, }, - buildDirWidget, + noMargin, + Form { + Tr::tr("Parameters:"), parametersLineEdit, br, + buildCfg->buildDirectoryAspect(), br + }, optionsFilterLineEdit, optionsTreeView, - noMargin }.attachTo(details); Column { + noMargin, container, Row { configureButton, wipeButton, noMargin } }.attachTo(this); - Form { - buildCfg->buildDirectoryAspect(), - noMargin - }.attachTo(buildDirWidget); - parametersLineEdit->setText(buildCfg->parameters()); optionsFilterLineEdit->setFiltering(true); diff --git a/src/plugins/perfprofiler/perftimelinemodel.cpp b/src/plugins/perfprofiler/perftimelinemodel.cpp index 03f0b80f094..2354d33ae84 100644 --- a/src/plugins/perfprofiler/perftimelinemodel.cpp +++ b/src/plugins/perfprofiler/perftimelinemodel.cpp @@ -145,7 +145,7 @@ QVariantMap PerfTimelineModel::details(int index) const manager->traceDuration())); const int guessedFrames = -frame.numSamples; if (guessedFrames > 0) - result.insert(Tr::tr("Guessed"), Tr::tr("%n frames", nullptr, guessedFrames)); + result.insert(Tr::tr("Guessed"), Tr::tr("%n frame(s)", nullptr, guessedFrames)); for (int i = 0, end = numAttributes(index); i < end; ++i) { const auto &name = orUnknown(manager->string( manager->attribute(attributeId(index, i)).name)); diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 3c76c2e62a0..b8ce9417e70 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -535,7 +535,7 @@ void AppOutputPane::storeSettings() const s->setValueWithDefault(WRAP_OUTPUT_KEY, m_settings.wrapOutput, kWrapOutputDefault); s->setValueWithDefault(MAX_LINES_KEY, m_settings.maxCharCount / 100, - Core::Constants::DEFAULT_MAX_CHAR_COUNT); + Core::Constants::DEFAULT_MAX_CHAR_COUNT / 100); } void AppOutputPane::loadSettings() @@ -551,7 +551,7 @@ void AppOutputPane::loadSettings() m_settings.mergeChannels = s->value(MERGE_CHANNELS_KEY, kMergeChannelsDefault).toBool(); m_settings.wrapOutput = s->value(WRAP_OUTPUT_KEY, kWrapOutputDefault).toBool(); m_settings.maxCharCount = s->value(MAX_LINES_KEY, - Core::Constants::DEFAULT_MAX_CHAR_COUNT).toInt() * 100; + Core::Constants::DEFAULT_MAX_CHAR_COUNT / 100).toInt() * 100; } void AppOutputPane::showTabFor(RunControl *rc) diff --git a/src/plugins/projectexplorer/copystep.cpp b/src/plugins/projectexplorer/copystep.cpp index db3b16098e5..6d5aef64db0 100644 --- a/src/plugins/projectexplorer/copystep.cpp +++ b/src/plugins/projectexplorer/copystep.cpp @@ -45,10 +45,10 @@ protected: m_source.asyncCopy(m_target, this, [this](const expected_str &cont) { if (!cont) { addOutput(cont.error(), OutputFormat::ErrorMessage); - addOutput(Tr::tr("Copying failed"), OutputFormat::ErrorMessage); + addOutput(Tr::tr("Copying failed."), OutputFormat::ErrorMessage); emit finished(false); } else { - addOutput(Tr::tr("Copying finished"), OutputFormat::NormalMessage); + addOutput(Tr::tr("Copying finished."), OutputFormat::NormalMessage); emit finished(true); } }); diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp index a35387a3c28..280b6139f87 100644 --- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp @@ -121,6 +121,7 @@ void DeviceSettingsWidget::initGui() if (!factory->quickCreationAllowed()) continue; + //: Add QAction *action = new QAction(Tr::tr("Add %1").arg(factory->displayName())); deviceTypeMenu->addAction(action); diff --git a/src/plugins/projectexplorer/environmentaspectwidget.cpp b/src/plugins/projectexplorer/environmentaspectwidget.cpp index 34e48af42c9..c167cd4e52f 100644 --- a/src/plugins/projectexplorer/environmentaspectwidget.cpp +++ b/src/plugins/projectexplorer/environmentaspectwidget.cpp @@ -65,7 +65,8 @@ EnvironmentAspectWidget::EnvironmentAspectWidget(EnvironmentAspect *aspect) topLayout->addWidget(m_environmentWidget); if (m_aspect->isPrintOnRunAllowed()) { - const auto printOnRunCheckBox = new QCheckBox(Tr::tr("Show in output pane when running")); + const auto printOnRunCheckBox = new QCheckBox( + Tr::tr("Show in Application Output when running")); printOnRunCheckBox->setChecked(m_aspect->isPrintOnRunEnabled()); connect(printOnRunCheckBox, &QCheckBox::toggled, m_aspect, &EnvironmentAspect::setPrintOnRun); diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 5a155794460..a685f0691ea 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -502,7 +502,7 @@ ExecutableAspect::ExecutableAspect(Target *target, ExecutionDeviceSelector selec setId("ExecutableAspect"); addDataExtractor(this, &ExecutableAspect::executable, &Data::executable); - m_executable.setPlaceHolderText(Tr::tr("path to the executable cannot be empty")); + m_executable.setPlaceHolderText(Tr::tr("Enter the path to the executable")); m_executable.setLabelText(Tr::tr("Executable:")); m_executable.setDisplayStyle(StringAspect::LabelDisplay); @@ -845,7 +845,7 @@ void InterpreterAspect::addToLayout(LayoutItem &builder) Core::ICore::showOptionsDialog(m_settingsDialogId); }); - builder.addItems({Tr::tr("Interpreter"), m_comboBox.data(), manageButton}); + builder.addItems({Tr::tr("Interpreter:"), m_comboBox.data(), manageButton}); } void InterpreterAspect::updateCurrentInterpreter() diff --git a/src/plugins/python/pipsupport.cpp b/src/plugins/python/pipsupport.cpp index b420f24aa50..d6070663fb6 100644 --- a/src/plugins/python/pipsupport.cpp +++ b/src/plugins/python/pipsupport.cpp @@ -92,8 +92,9 @@ void PipInstallTask::handleDone() m_future.reportFinished(); const bool success = m_process.result() == ProcessResult::FinishedWithSuccess; if (!success) { - Core::MessageManager::writeFlashing(Tr::tr("Installing %1 failed with exit code %2") - .arg(packagesDisplayName()).arg(m_process.exitCode())); + Core::MessageManager::writeFlashing(Tr::tr("Installing \"%1\" failed with exit code %2.") + .arg(packagesDisplayName()) + .arg(m_process.exitCode())); } emit finished(success); } diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index daa4f591c03..da3c6e647e7 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -811,12 +811,12 @@ void PythonSettings::createVirtualEnvironmentInteractive( if (!preselectedId.isEmpty() && interpreter.id == preselectedId) interpreters->setCurrentIndex(interpreters->count() - 1); } - layout->addRow(Tr::tr("Python Interpreter"), interpreters); + layout->addRow(Tr::tr("Python interpreter:"), interpreters); auto pathChooser = new PathChooser(); pathChooser->setInitialBrowsePathBackup(startDirectory); pathChooser->setExpectedKind(PathChooser::Directory); pathChooser->setPromptDialogTitle(Tr::tr("New Python Virtual Environment Directory")); - layout->addRow(Tr::tr("Virtual Environment Directory"), pathChooser); + layout->addRow(Tr::tr("Virtual environment directory:"), pathChooser); auto buttons = new QDialogButtonBox(QDialogButtonBox::Cancel); auto createButton = buttons->addButton(Tr::tr("Create"), QDialogButtonBox::AcceptRole); createButton->setEnabled(false); diff --git a/src/plugins/python/pythonwizardpage.cpp b/src/plugins/python/pythonwizardpage.cpp index bcbca5a7072..253422ed20c 100644 --- a/src/plugins/python/pythonwizardpage.cpp +++ b/src/plugins/python/pythonwizardpage.cpp @@ -65,7 +65,7 @@ bool PythonWizardPageFactory::validateData(Id typeId, const QVariant &data, QStr if (items.isEmpty()) { if (errorMessage) { *errorMessage = Tr::tr("'data' of a Python wizard page expects a map with 'items' " - "containing a list of objects"); + "containing a list of objects."); } return false; } @@ -92,16 +92,16 @@ PythonWizardPage::PythonWizardPage(const QList> &pySide this, &PythonWizardPage::updateInterpreters); - m_pySideVersion.setLabelText(Tr::tr("PySide version")); + m_pySideVersion.setLabelText(Tr::tr("PySide version:")); m_pySideVersion.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox); for (auto [name, data] : pySideAndData) m_pySideVersion.addOption(SelectionAspect::Option(name, {}, data)); if (defaultPyside >= 0) m_pySideVersion.setDefaultValue(defaultPyside); - m_createVenv.setLabelText(Tr::tr("Create new Virtual Environment")); + m_createVenv.setLabelText(Tr::tr("Create new virtual environment")); - m_venvPath.setLabelText(Tr::tr("Path to virtual environment")); + m_venvPath.setLabelText(Tr::tr("Path to virtual environment:")); m_venvPath.setEnabler(&m_createVenv); m_venvPath.setExpectedKind(PathChooser::Directory); diff --git a/src/plugins/qbsprojectmanager/qbssession.cpp b/src/plugins/qbsprojectmanager/qbssession.cpp index 13121cfb66e..d2e5d130f0e 100644 --- a/src/plugins/qbsprojectmanager/qbssession.cpp +++ b/src/plugins/qbsprojectmanager/qbssession.cpp @@ -240,6 +240,7 @@ QString QbsSession::errorString(QbsSession::Error error) case Error::ProtocolError: return Tr::tr("The qbs process sent unexpected data."); case Error::VersionMismatch: + //: %1 == "Qt Creator" or "Qt Design Studio" return Tr::tr("The qbs API level is not compatible with " "what %1 expects.") .arg(Core::Constants::IDE_DISPLAY_NAME); diff --git a/src/plugins/qbsprojectmanager/qbssettings.cpp b/src/plugins/qbsprojectmanager/qbssettings.cpp index 91e4763bf25..58c9b96c698 100644 --- a/src/plugins/qbsprojectmanager/qbssettings.cpp +++ b/src/plugins/qbsprojectmanager/qbssettings.cpp @@ -150,6 +150,7 @@ public: m_qbsExePathChooser.setFilePath(QbsSettings::qbsExecutableFilePath()); m_defaultInstallDirLineEdit.setText(QbsSettings::defaultInstallDirTemplate()); m_versionLabel.setText(getQbsVersionString()); + //: %1 == "Qt Creator" or "Qt Design Studio" m_settingsDirCheckBox.setText(Tr::tr("Use %1 settings directory for Qbs") .arg(Core::Constants::IDE_DISPLAY_NAME)); m_settingsDirCheckBox.setChecked(QbsSettings::useCreatorSettingsDirForQbs()); diff --git a/src/plugins/qmldesigner/components/componentcore/qmleditormenu.h b/src/plugins/qmldesigner/components/componentcore/qmleditormenu.h index 4163fccbead..2b7ecb386b9 100644 --- a/src/plugins/qmldesigner/components/componentcore/qmleditormenu.h +++ b/src/plugins/qmldesigner/components/componentcore/qmleditormenu.h @@ -5,7 +5,9 @@ #include +QT_BEGIN_NAMESPACE class QStyleOptionMenuItem; +QT_END_NAMESPACE namespace QmlDesigner { diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dactions.h b/src/plugins/qmldesigner/components/edit3d/edit3dactions.h index 4e8be202b9f..4cf1ab837d8 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dactions.h +++ b/src/plugins/qmldesigner/components/edit3d/edit3dactions.h @@ -8,7 +8,10 @@ #include #include +QT_BEGIN_NAMESPACE class QWidgetAction; +QT_END_NAMESPACE + namespace QmlDesigner { using SelectionContextOperation = std::function; diff --git a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp index 81b8a32a083..0b8a7f46853 100644 --- a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp +++ b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp @@ -514,7 +514,7 @@ void QmlDesignerProjectManager::fileListChanged() void QmlDesignerProjectManager::activeTargetChanged(ProjectExplorer::Target *target) { - if (m_projectData) + if (!m_projectData) return; QObject::disconnect(m_projectData->activeTarget, nullptr, nullptr, nullptr); diff --git a/src/plugins/qmljseditor/qmljseditingsettingspage.cpp b/src/plugins/qmljseditor/qmljseditingsettingspage.cpp index c40000b09f1..3b53185bcfe 100644 --- a/src/plugins/qmljseditor/qmljseditingsettingspage.cpp +++ b/src/plugins/qmljseditor/qmljseditingsettingspage.cpp @@ -417,9 +417,11 @@ public: QObject::connect(useCustomAnalyzer, &QCheckBox::stateChanged, this, [this](int checked){ analyzerMessagesView->setEnabled(checked != Qt::Unchecked); }); - analyzerMessagesView->setToolTip(Tr::tr("Enabled checks can be disabled for non Qt Quick UI" - " files,\nbut disabled checks cannot get explicitly" - " enabled for non Qt Quick UI files.")); + analyzerMessagesView->setToolTip( + "" + + Tr::tr("Enabled checks can be disabled for non Qt Quick UI" + " files, but disabled checks cannot get explicitly" + " enabled for non Qt Quick UI files.")); analyzerMessagesView->setContextMenuPolicy(Qt::CustomContextMenu); connect(analyzerMessagesView, &QTreeView::customContextMenuRequested, this, &QmlJsEditingSettingsPageWidget::showContextMenu); diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index ccc94a5ea42..1bd8ef89ff8 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -311,8 +311,7 @@ void QmlJSEditorWidget::updateContextPane() if (m_contextPane->isAvailable(this, info.document, newNode) && !m_contextPane->widget()->isVisible()) { - QList markers - = RefactorMarker::filterOutType(refactorMarkers(), QT_QUICK_TOOLBAR_MARKER_ID); + RefactorMarkers markers; if (UiObjectMember *m = newNode->uiObjectMemberCast()) { const int start = qualifiedTypeNameId(m)->identifierToken.begin(); for (UiQualifiedId *q = qualifiedTypeNameId(m); q; q = q->next) { @@ -333,10 +332,9 @@ void QmlJSEditorWidget::updateContextPane() } } } - setRefactorMarkers(markers); + setRefactorMarkers(markers, QT_QUICK_TOOLBAR_MARKER_ID); } else if (oldNode != newNode) { - setRefactorMarkers( - RefactorMarker::filterOutType(refactorMarkers(), QT_QUICK_TOOLBAR_MARKER_ID)); + clearRefactorMarkers(QT_QUICK_TOOLBAR_MARKER_ID); } m_oldCursorPosition = position(); @@ -877,8 +875,7 @@ void QmlJSEditorWidget::showContextPane() &scopeChain, newNode, false, true); m_oldCursorPosition = position(); - setRefactorMarkers( - RefactorMarker::filterOutType(refactorMarkers(), QT_QUICK_TOOLBAR_MARKER_ID)); + clearRefactorMarkers(QT_QUICK_TOOLBAR_MARKER_ID); } } diff --git a/src/plugins/terminal/shortcutmap.h b/src/plugins/terminal/shortcutmap.h index e3de7e01bdf..956c3b5c9e7 100644 --- a/src/plugins/terminal/shortcutmap.h +++ b/src/plugins/terminal/shortcutmap.h @@ -7,8 +7,10 @@ #include #include +QT_BEGIN_NAMESPACE class QKeyEvent; class QObject; +QT_END_NAMESPACE namespace Terminal::Internal { diff --git a/src/plugins/texteditor/markdowneditor.cpp b/src/plugins/texteditor/markdowneditor.cpp index 90ca41283ec..fdde77e9dbd 100644 --- a/src/plugins/texteditor/markdowneditor.cpp +++ b/src/plugins/texteditor/markdowneditor.cpp @@ -322,7 +322,7 @@ MarkdownEditorFactory::MarkdownEditorFactory() }) { setId(MARKDOWNVIEWER_ID); - setDisplayName(::Core::Tr::tr("Markdown Viewer")); + setDisplayName(::Core::Tr::tr("Markdown Editor")); addMimeType(MARKDOWNVIEWER_MIME_TYPE); setEditorCreator([] { return new MarkdownEditor; }); } diff --git a/src/plugins/texteditor/refactoroverlay.cpp b/src/plugins/texteditor/refactoroverlay.cpp index 49d900c0ada..e1f6ff2c7cd 100644 --- a/src/plugins/texteditor/refactoroverlay.cpp +++ b/src/plugins/texteditor/refactoroverlay.cpp @@ -24,14 +24,21 @@ RefactorOverlay::RefactorOverlay(TextEditor::TextEditorWidget *editor) : void RefactorOverlay::paint(QPainter *painter, const QRect &clip) { + const auto firstBlock = m_editor->blockForVerticalOffset(clip.top()); + const auto lastBlock = m_editor->blockForVerticalOffset(clip.bottom()); + m_maxWidth = 0; - for (auto &marker : std::as_const(m_markers)) { + for (const RefactorMarker &marker : std::as_const(m_markers)) { + const int markerBlockNumber = marker.cursor.block().blockNumber(); + if (markerBlockNumber < firstBlock.blockNumber()) + continue; + if (markerBlockNumber > lastBlock.blockNumber()) + continue; paintMarker(marker, painter, clip); } if (auto documentLayout = qobject_cast(m_editor->document()->documentLayout())) documentLayout->setRequiredWidth(m_maxWidth); - } RefactorMarker RefactorOverlay::markerAt(const QPoint &pos) const diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 33323b3b76a..cd2d0013e89 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4530,12 +4530,7 @@ int TextEditorWidgetPrivate::indentDepthForBlock(const QTextBlock &block, const m_visualIndentCache.resize(size, -1); }; int depth = blockDepth(block); - if (depth < 0) // the block was empty and uncached ask the indenter for a visual indentation - depth = m_document->indenter()->visualIndentFor(block, data.tabSettings); - if (depth >= 0) { - ensureCacheSize(block.blockNumber() + 1); - m_visualIndentCache[block.blockNumber()] = depth; - } else { + if (depth < 0) { // find previous non empty block and get the indent depth of this block QTextBlock it = block.previous(); int prevDepth = -1; @@ -5164,10 +5159,13 @@ void TextEditorWidgetPrivate::slotUpdateExtraAreaWidth(std::optional width) { if (!width.has_value()) width = q->extraAreaWidth(); + QMargins margins; if (q->isLeftToRight()) - q->setViewportMargins(*width, 0, 0, 0); + margins = QMargins(*width, 0, 0, 0); else - q->setViewportMargins(0, 0, *width, 0); + margins = QMargins(0, 0, *width, 0); + if (margins != q->viewportMargins()) + q->setViewportMargins(margins); } struct Internal::ExtraAreaPaintEventData @@ -8557,6 +8555,38 @@ void TextEditorWidget::setRefactorMarkers(const RefactorMarkers &markers) emit requestBlockUpdate(marker.cursor.block()); } +void TextEditorWidget::setRefactorMarkers(const RefactorMarkers &newMarkers, const Utils::Id &type) +{ + RefactorMarkers markers = d->m_refactorOverlay->markers(); + auto first = std::partition(markers.begin(), + markers.end(), + [type](const RefactorMarker &marker) { + return marker.type == type; + }); + + for (auto it = markers.begin(); it != first; ++it) + emit requestBlockUpdate(it->cursor.block()); + markers.erase(markers.begin(), first); + markers.append(newMarkers); + d->m_refactorOverlay->setMarkers(markers); + for (const RefactorMarker &marker : newMarkers) + emit requestBlockUpdate(marker.cursor.block()); +} + +void TextEditorWidget::clearRefactorMarkers(const Utils::Id &type) +{ + RefactorMarkers markers = d->m_refactorOverlay->markers(); + for (auto it = markers.begin(); it != markers.end();) { + if (it->type == type) { + emit requestBlockUpdate(it->cursor.block()); + it = markers.erase(it); + } else { + ++it; + } + } + d->m_refactorOverlay->setMarkers(markers); +} + bool TextEditorWidget::inFindScope(const QTextCursor &cursor) const { return d->m_find->inScope(cursor); diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h index e7cb5b34347..c05425a5b07 100644 --- a/src/plugins/texteditor/texteditor.h +++ b/src/plugins/texteditor/texteditor.h @@ -310,6 +310,8 @@ public: RefactorMarkers refactorMarkers() const; void setRefactorMarkers(const RefactorMarkers &markers); + void setRefactorMarkers(const RefactorMarkers &markers, const Utils::Id &type); + void clearRefactorMarkers(const Utils::Id &type); enum Side { Left, Right }; QAction *insertExtraToolBarWidget(Side side, QWidget *widget); diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index 4257adbbdb0..5e54f585d2e 100644 --- a/src/plugins/texteditor/texteditoroverlay.cpp +++ b/src/plugins/texteditor/texteditoroverlay.cpp @@ -326,9 +326,18 @@ void TextEditorOverlay::fillSelection(QPainter *painter, void TextEditorOverlay::paint(QPainter *painter, const QRect &clip) { Q_UNUSED(clip) - for (int i = m_selections.size()-1; i >= 0; --i) { + + const auto firstBlock = m_editor->blockForVerticalOffset(clip.top()); + const auto lastBlock = m_editor->blockForVerticalOffset(clip.bottom()); + + auto overlapsClip = [&](const OverlaySelection &selection) { + return selection.m_cursor_end.blockNumber() >= firstBlock.blockNumber() + && selection.m_cursor_begin.blockNumber() <= lastBlock.blockNumber(); + }; + + for (int i = m_selections.size() - 1; i >= 0; --i) { const OverlaySelection &selection = m_selections.at(i); - if (selection.m_dropShadow) + if (selection.m_dropShadow || !overlapsClip(selection)) continue; if (selection.m_fixedLength >= 0 && selection.m_cursor_end.position() - selection.m_cursor_begin.position() @@ -337,9 +346,9 @@ void TextEditorOverlay::paint(QPainter *painter, const QRect &clip) paintSelection(painter, selection, clip); } - for (int i = m_selections.size()-1; i >= 0; --i) { + for (int i = m_selections.size() - 1; i >= 0; --i) { const OverlaySelection &selection = m_selections.at(i); - if (!selection.m_dropShadow) + if (!selection.m_dropShadow || !overlapsClip(selection)) continue; if (selection.m_fixedLength >= 0 && selection.m_cursor_end.position() - selection.m_cursor_begin.position() diff --git a/src/plugins/valgrind/valgrindconfigwidget.cpp b/src/plugins/valgrind/valgrindconfigwidget.cpp index d8999c9e690..2200eb5b254 100644 --- a/src/plugins/valgrind/valgrindconfigwidget.cpp +++ b/src/plugins/valgrind/valgrindconfigwidget.cpp @@ -40,7 +40,7 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings) { using namespace Layouting; ValgrindBaseSettings &s = *settings; - + // clang-format off Grid generic { s.valgrindExecutable, br, s.valgrindArguments, br, @@ -78,10 +78,11 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings) Column { Group { title(Tr::tr("Valgrind Generic Settings")), generic }, - Group { title(Tr::tr("MemCheck Memory Analysis Options")), memcheck }, - Group { title(Tr::tr("CallGrind Profiling Options")), callgrind }, + Group { title(Tr::tr("Memcheck Memory Analysis Options")), memcheck }, + Group { title(Tr::tr("Callgrind Profiling Options")), callgrind }, st, }.attachTo(this); + // clang-format on } // ValgrindOptionsPage diff --git a/src/plugins/valgrind/valgrindsettings.cpp b/src/plugins/valgrind/valgrindsettings.cpp index 5be58ea3b8c..4db2e39c3a5 100644 --- a/src/plugins/valgrind/valgrindsettings.cpp +++ b/src/plugins/valgrind/valgrindsettings.cpp @@ -233,7 +233,7 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global) // Memcheck memcheckArguments.setSettingsKey(base + "Memcheck.Arguments"); memcheckArguments.setDisplayStyle(StringAspect::LineEditDisplay); - memcheckArguments.setLabelText(Tr::tr("Extra MemCheck arguments:")); + memcheckArguments.setLabelText(Tr::tr("Extra Memcheck arguments:")); filterExternalIssues.setSettingsKey(base + "FilterExternalIssues"); filterExternalIssues.setDefaultValue(true); @@ -273,7 +273,7 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global) callgrindArguments.setSettingsKey(base + "Callgrind.Arguments"); callgrindArguments.setDisplayStyle(StringAspect::LineEditDisplay); - callgrindArguments.setLabelText(Tr::tr("Extra CallGrind arguments:")); + callgrindArguments.setLabelText(Tr::tr("Extra Callgrind arguments:")); enableEventToolTips.setDefaultValue(true); enableEventToolTips.setSettingsKey(base + "Callgrind.EnableEventToolTips"); diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h index 8b4a9e79aaf..da681b3bbe6 100644 --- a/src/shared/proparser/qmakeevaluator.h +++ b/src/shared/proparser/qmakeevaluator.h @@ -45,12 +45,11 @@ public: int exitCode = 0; }; +QT_BEGIN_NAMESPACE + QMAKE_EXPORT std::function &theProcessRunner(); QMAKE_EXPORT QString removeHostAndScheme(const QString &remotePath); - -QT_BEGIN_NAMESPACE - class QMakeGlobals; class QMAKE_EXPORT QMakeHandler : public QMakeParserHandler diff --git a/src/tools/process_stub/main.cpp b/src/tools/process_stub/main.cpp index d5fdc2f4086..bfb6f6c3211 100644 --- a/src/tools/process_stub/main.cpp +++ b/src/tools/process_stub/main.cpp @@ -542,6 +542,8 @@ void onControlSocketReadyRead() break; } } + + sendMsg(QString("ack %1\n").arg(ch).toUtf8()); } } diff --git a/tests/auto/utils/filepath/tst_filepath.cpp b/tests/auto/utils/filepath/tst_filepath.cpp index 3699ec6b2e8..f9e10d5e207 100644 --- a/tests/auto/utils/filepath/tst_filepath.cpp +++ b/tests/auto/utils/filepath/tst_filepath.cpp @@ -9,15 +9,17 @@ #include #include -using namespace Utils; - +QT_BEGIN_NAMESPACE namespace QTest { template<> -char *toString(const FilePath &filePath) +char *toString(const Utils::FilePath &filePath) { return qstrdup(filePath.toString().toLocal8Bit().constData()); } } // namespace QTest +QT_END_NAMESPACE + +namespace Utils { class tst_filepath : public QObject { @@ -737,7 +739,12 @@ public: ExpectedPass expectedPass = PassEverywhere; }; -Q_DECLARE_METATYPE(FromStringData); +} // Utils + + +Q_DECLARE_METATYPE(Utils::FromStringData); + +namespace Utils { void tst_filepath::fromString_data() { @@ -1683,6 +1690,8 @@ void tst_filepath::sort_data() << QStringList{"b://b//b", "a://b//b", "a://a//b", "a://b//a", "a://a//a"}; } -QTEST_GUILESS_MAIN(tst_filepath) +} // Utils + +QTEST_GUILESS_MAIN(Utils::tst_filepath) #include "tst_filepath.moc" diff --git a/tests/auto/utils/fileutils/tst_fileutils.cpp b/tests/auto/utils/fileutils/tst_fileutils.cpp index 198abf3398b..8208e634120 100644 --- a/tests/auto/utils/fileutils/tst_fileutils.cpp +++ b/tests/auto/utils/fileutils/tst_fileutils.cpp @@ -7,15 +7,33 @@ #include //TESTED_COMPONENT=src/libs/utils -using namespace Utils; +QT_BEGIN_NAMESPACE namespace QTest { + template<> -char *toString(const FilePath &filePath) +char *toString(const Utils::FilePath &filePath) { return qstrdup(filePath.toString().toLocal8Bit().constData()); } + +template<> +char *toString(const Utils::FilePathInfo &filePathInfo) +{ + QByteArray ba = "FilePathInfo("; + ba += QByteArray::number(filePathInfo.fileSize); + ba += ", "; + ba += QByteArray::number(filePathInfo.fileFlags, 16); + ba += ", "; + ba += filePathInfo.lastModified.toString().toUtf8(); + ba += ")"; + return qstrdup(ba.constData()); +} + } // namespace QTest +QT_END_NAMESPACE + +using namespace Utils; class tst_fileutils : public QObject { @@ -183,23 +201,6 @@ void tst_fileutils::filePathInfoFromTriple() QCOMPARE(result, expected); } -QT_BEGIN_NAMESPACE -namespace QTest { -template<> -char *toString(const FilePathInfo &filePathInfo) -{ - QByteArray ba = "FilePathInfo("; - ba += QByteArray::number(filePathInfo.fileSize); - ba += ", "; - ba += QByteArray::number(filePathInfo.fileFlags, 16); - ba += ", "; - ba += filePathInfo.lastModified.toString().toUtf8(); - ba += ")"; - return qstrdup(ba.constData()); -} - -} // namespace QTest - QTEST_GUILESS_MAIN(tst_fileutils) #include "tst_fileutils.moc" diff --git a/tests/auto/utils/unixdevicefileaccess/tst_unixdevicefileaccess.cpp b/tests/auto/utils/unixdevicefileaccess/tst_unixdevicefileaccess.cpp index b5aef12d06c..3e62be9147d 100644 --- a/tests/auto/utils/unixdevicefileaccess/tst_unixdevicefileaccess.cpp +++ b/tests/auto/utils/unixdevicefileaccess/tst_unixdevicefileaccess.cpp @@ -12,15 +12,18 @@ #include //TESTED_COMPONENT=src/libs/utils -using namespace Utils; +QT_BEGIN_NAMESPACE namespace QTest { template<> -char *toString(const FilePath &filePath) +char *toString(const Utils::FilePath &filePath) { return qstrdup(filePath.toString().toLocal8Bit().constData()); } } // namespace QTest +QT_END_NAMESPACE + +using namespace Utils; class TestDFA : public UnixDeviceFileAccess { diff --git a/tests/system/suite_WELP/tst_WELP04/test.py b/tests/system/suite_WELP/tst_WELP04/test.py index a83afd3e819..557059a3309 100644 --- a/tests/system/suite_WELP/tst_WELP04/test.py +++ b/tests/system/suite_WELP/tst_WELP04/test.py @@ -3,6 +3,13 @@ source("../../shared/qtcreator.py") + +def __waitForListView__(): + listView = waitForObject("{container=':Qt Creator.WelcomeScreenStackedWidget' " + "type='QListView' unnamed='1' visible='1'}") + return listView + + def main(): # open Qt Creator startQC() @@ -22,14 +29,14 @@ def main(): searchTutorials = waitForObject("{type='QLineEdit' placeholderText='Search in Tutorials...'}") mouseClick(searchTutorials) replaceEditorContent(searchTutorials, "qwerty") - listView = waitForObject("{type='QListView' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}") + listView = __waitForListView__() waitFor('findExampleOrTutorial(listView, ".*") is None', 3000) tutorial = findExampleOrTutorial(listView, ".*", True) test.verify(tutorial is None, "Verifying: 'Tutorials' topic is opened and nothing is shown.") bnr = "Help: Building and Running an Example" replaceEditorContent(searchTutorials, bnr.lower()) + listView = __waitForListView__() waitFor('findExampleOrTutorial(listView, "%s.*") is not None' % bnr, 3000) tutorial = findExampleOrTutorial(listView, "%s.*" % bnr, True) test.verify(tutorial is not None, "Verifying: Expected Text tutorial is shown.") @@ -46,6 +53,7 @@ def main(): mouseClick(searchTutorials) replaceEditorContent(searchTutorials, "embedded device") embeddedTutorial = "Online: How to install and set up Qt for Device Creation.*" + listView = __waitForListView__() waitFor('findExampleOrTutorial(listView, embeddedTutorial) is not None', 3000) tutorial = findExampleOrTutorial(listView, embeddedTutorial, True) test.verify(tutorial is not None, diff --git a/tests/system/suite_debugger/tst_qml_locals/test.py b/tests/system/suite_debugger/tst_qml_locals/test.py index 37ecb515cc6..525f45f95fa 100644 --- a/tests/system/suite_debugger/tst_qml_locals/test.py +++ b/tests/system/suite_debugger/tst_qml_locals/test.py @@ -48,13 +48,9 @@ def main(): earlyExit("Could not find expected Inspector tree inside Locals and Expressions.") return # reduce items to outer Rectangle object - items = items.getChild("QQuickView") + items = items.getChild("QQmlApplicationEngine") if items == None: - earlyExit("Could not find expected QQuickView tree inside Locals and Expressions.") - return - items = items.getChild("QQuickRootItem") - if items == None: - earlyExit("Could not find expected QQuickRootItem tree inside Locals and Expressions.") + earlyExit("Could not find expected QQmlApplicationEngine tree inside Locals and Expressions.") return items = items.getChild("Rectangle") if items == None: @@ -76,13 +72,14 @@ def main(): invokeMenuItem("File", "Exit") def __unfoldTree__(): + view = waitForObject(':Locals and Expressions_Debugger::Internal::WatchTreeView') # TODO inspect the qmlengine as well? - rootIndex = getQModelIndexStr("text='QQuickView'", + rootIndex = getQModelIndexStr("text='QQmlApplicationEngine'", ':Locals and Expressions_Debugger::Internal::WatchTreeView') - unfoldQModelIndex(rootIndex, False) - quickRootItem = getQModelIndexStr("text='QQuickRootItem'", rootIndex) - unfoldQModelIndex(quickRootItem, False) - mainRect = getQModelIndexStr("text='Rectangle'", quickRootItem) + if not test.verify(view.isExpanded(waitForObject(rootIndex)), + "QQmlApplicationEngine should be expanded already."): + unfoldQModelIndex(rootIndex, False) + mainRect = getQModelIndexStr("text='Rectangle'", rootIndex) unfoldQModelIndex(mainRect) subItems = ["text='Rectangle'", "text='Rectangle' occurrence='2'", "text='Text'"] for item in subItems: diff --git a/tests/system/suite_editors/tst_delete_externally/test.py b/tests/system/suite_editors/tst_delete_externally/test.py index 4369e36ecd5..e36377cb56b 100644 --- a/tests/system/suite_editors/tst_delete_externally/test.py +++ b/tests/system/suite_editors/tst_delete_externally/test.py @@ -20,6 +20,7 @@ def main(): "Skipping this file for now.") continue + editorRealName = objectMap.realName(editor) contentBefore = readFile(currentFile) os.remove(currentFile) if not currentFile.endswith(".bin"): @@ -40,6 +41,6 @@ def main(): test.compare(waitForObject(":File has been removed_QMessageBox").text, popupText % currentFile) clickButton(waitForObject(":File has been removed.Close_QPushButton")) - test.verify(checkIfObjectExists(objectMap.realName(editor), False), + test.verify(checkIfObjectExists(editorRealName, False), "Was the editor closed after deleting the file?") invokeMenuItem("File", "Exit") diff --git a/tests/unit/unittest/listmodeleditor-test.cpp b/tests/unit/unittest/listmodeleditor-test.cpp index 146ba65ad5d..8a5e09dc168 100644 --- a/tests/unit/unittest/listmodeleditor-test.cpp +++ b/tests/unit/unittest/listmodeleditor-test.cpp @@ -218,7 +218,7 @@ TEST_F(ListModelEditor, HorizontalLabels) { model.setListModel(listModelNode); - ASSERT_THAT(headerLabels(model), ElementsAre("image", "name", "value", "value2")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"image", u"name", u"value", u"value2")); } TEST_F(ListModelEditor, HorizontalLabelsForEmptyList) @@ -372,7 +372,7 @@ TEST_F(ListModelEditor, AddColumnInsertsHeaderLabel) model.addColumn("other"); - ASSERT_THAT(headerLabels(model), ElementsAre("image", "name", "other", "value", "value2")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"image", u"name", u"other", u"value", u"value2")); } TEST_F(ListModelEditor, AddColumnInsertsHeaderLabelToEmptyModel) @@ -381,7 +381,7 @@ TEST_F(ListModelEditor, AddColumnInsertsHeaderLabelToEmptyModel) model.addColumn("foo"); - ASSERT_THAT(headerLabels(model), ElementsAre("foo")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"foo")); } TEST_F(ListModelEditor, AddTwiceColumnInsertsHeaderLabelToEmptyModel) @@ -391,7 +391,7 @@ TEST_F(ListModelEditor, AddTwiceColumnInsertsHeaderLabelToEmptyModel) model.addColumn("foo2"); - ASSERT_THAT(headerLabels(model), ElementsAre("foo", "foo2")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"foo", u"foo2")); } TEST_F(ListModelEditor, AddSameColumnInsertsHeaderLabel) @@ -401,7 +401,7 @@ TEST_F(ListModelEditor, AddSameColumnInsertsHeaderLabel) model.addColumn("foo"); - ASSERT_THAT(headerLabels(model), ElementsAre("foo")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"foo")); } TEST_F(ListModelEditor, AddColumnInsertsDisplayValues) @@ -517,7 +517,7 @@ TEST_F(ListModelEditor, DontConvertStringToNumber) model.setValue(1, 1, "hello"); - ASSERT_THAT(element2.variantProperty("name").value().value(), "hello"); + ASSERT_THAT(element2.variantProperty("name").value().value(), u"hello"); ASSERT_THAT(element2.variantProperty("name").value().type(), QVariant::String); } @@ -527,7 +527,7 @@ TEST_F(ListModelEditor, EmptyStringsRemovesProperty) model.setValue(1, 1, ""); - ASSERT_THAT(element2.variantProperty("name").value().value(), Eq("")); + ASSERT_THAT(element2.variantProperty("name").value().value(), Eq(u"")); } TEST_F(ListModelEditor, InvalidVariantRemovesProperty) @@ -652,7 +652,7 @@ TEST_F(ListModelEditor, DontRenameColumnIfColumnNameExists) model.renameColumn(1, "value2"); - ASSERT_THAT(headerLabels(model), ElementsAre("image", "name", "value", "value2")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"image", u"name", u"value", u"value2")); } TEST_F(ListModelEditor, DontRenameColumnIfColumnNameExistsDoesNotChangeDisplayValues) @@ -700,7 +700,7 @@ TEST_F(ListModelEditor, RenameColumnButDontChangeOrder) model.renameColumn(1, "mood"); - ASSERT_THAT(headerLabels(model), ElementsAre("image", "mood", "value", "value2")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"image", u"mood", u"value", u"value2")); } TEST_F(ListModelEditor, RenameColumnButDontChangeOrderDisplayValues) @@ -801,7 +801,7 @@ TEST_F(ListModelEditor, RenameToPrecedingColumn) model.renameColumn(1, "alpha"); - ASSERT_THAT(headerLabels(model), ElementsAre("alpha", "image", "value", "value2")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"alpha", u"image", u"value", u"value2")); } TEST_F(ListModelEditor, RenameToPrecedingColumnDisplayValues) @@ -849,7 +849,7 @@ TEST_F(ListModelEditor, RenameToFollowingColumn) model.renameColumn(2, "zoo"); - ASSERT_THAT(headerLabels(model), ElementsAre("image", "name", "value2", "zoo")); + ASSERT_THAT(headerLabels(model), ElementsAre(u"image", u"name", u"value2", u"zoo")); } TEST_F(ListModelEditor, RenameToFollowingColumnDisplayValues) diff --git a/tests/unit/unittest/modulescanner-test.cpp b/tests/unit/unittest/modulescanner-test.cpp index 554e3fc8398..a3e8923fd76 100644 --- a/tests/unit/unittest/modulescanner-test.cpp +++ b/tests/unit/unittest/modulescanner-test.cpp @@ -37,11 +37,11 @@ auto CorePropertiesHave(const Matcher &matcher) template auto NonCorePropertiesHave(const Matcher &matcher) { - return Not(Contains(AllOf(UrlProperty(AnyOf(Eq("QtQuick"), - Eq("QtQuick.Controls"), - Eq("QtQuick3D"), - Eq("QtQuick3D.Helpers"), - Eq("QtQuick3D.Particles3D"))), + return Not(Contains(AllOf(UrlProperty(AnyOf(Eq(u"QtQuick"), + Eq(u"QtQuick.Controls"), + Eq(u"QtQuick3D"), + Eq(u"QtQuick3D.Helpers"), + Eq(u"QtQuick3D.Particles3D"))), matcher))); } diff --git a/tests/unit/unittest/qmlprojectmanager/projectitem-test.cpp b/tests/unit/unittest/qmlprojectmanager/projectitem-test.cpp index 3bf214fd81f..294c2e9d77a 100644 --- a/tests/unit/unittest/qmlprojectmanager/projectitem-test.cpp +++ b/tests/unit/unittest/qmlprojectmanager/projectitem-test.cpp @@ -55,14 +55,14 @@ TEST_F(QmlProjectItem, GetNotEmptyMainFileProject) { auto mainFile = projectItemNotEmpty->mainFile(); - ASSERT_THAT(mainFile, Eq("content/App.qml")); + ASSERT_THAT(mainFile, Eq(u"content/App.qml")); } TEST_F(QmlProjectItem, GetNotEmptyMainUIFileProject) { auto mainUiFile = projectItemNotEmpty->mainUiFile(); - ASSERT_THAT(mainUiFile, Eq("Screen01.ui.qml")); + ASSERT_THAT(mainUiFile, Eq(u"Screen01.ui.qml")); } TEST_F(QmlProjectItem, GetNotEmptyMcuProject) @@ -76,21 +76,21 @@ TEST_F(QmlProjectItem, GetNotEmptyQtVersion) { auto qtVersion = projectItemNotEmpty->versionQt(); - ASSERT_THAT(qtVersion, Eq("6")); + ASSERT_THAT(qtVersion, Eq(u"6")); } TEST_F(QmlProjectItem, GetNotEmptyQtQuickVersion) { auto qtQuickVersion = projectItemNotEmpty->versionQtQuick(); - ASSERT_THAT(qtQuickVersion, Eq("6.2")); + ASSERT_THAT(qtQuickVersion, Eq(u"6.2")); } TEST_F(QmlProjectItem, GetNotEmptyDesignStudioVersion) { auto designStudioVersion = projectItemNotEmpty->versionDesignStudio(); - ASSERT_THAT(designStudioVersion, Eq("3.9")); + ASSERT_THAT(designStudioVersion, Eq(u"3.9")); } TEST_F(QmlProjectItem, GetNotEmptySourceDirectory) @@ -106,21 +106,21 @@ TEST_F(QmlProjectItem, GetNotEmptyTarGetNotEmptyDirectory) { auto targetDirectory = projectItemNotEmpty->targetDirectory(); - ASSERT_THAT(targetDirectory, Eq("/opt/targetDirectory")); + ASSERT_THAT(targetDirectory, Eq(u"/opt/targetDirectory")); } TEST_F(QmlProjectItem, GetNotEmptyImportPaths) { auto importPaths = projectItemNotEmpty->importPaths(); - ASSERT_THAT(importPaths, UnorderedElementsAre("imports", "asset_imports")); + ASSERT_THAT(importPaths, UnorderedElementsAre(u"imports", u"asset_imports")); } TEST_F(QmlProjectItem, GetNotEmptyFileSelectors) { auto fileSelectors = projectItemNotEmpty->fileSelectors(); - ASSERT_THAT(fileSelectors, UnorderedElementsAre("WXGA", "darkTheme", "ShowIndicator")); + ASSERT_THAT(fileSelectors, UnorderedElementsAre(u"WXGA", u"darkTheme", u"ShowIndicator")); } TEST_F(QmlProjectItem, GetNotEmptyMultiLanguageSupport) @@ -134,7 +134,7 @@ TEST_F(QmlProjectItem, GetNotEmptySupportedLanguages) { auto supportedLanguages = projectItemNotEmpty->supportedLanguages(); - ASSERT_THAT(supportedLanguages, UnorderedElementsAre("en", "fr")); + ASSERT_THAT(supportedLanguages, UnorderedElementsAre(u"en", u"fr")); } TEST_F(QmlProjectItem, GetNotEmptyPrimaryLanguage) @@ -142,7 +142,7 @@ TEST_F(QmlProjectItem, GetNotEmptyPrimaryLanguage) auto primaryLanguage = projectItemNotEmpty->primaryLanguage(); ; - ASSERT_THAT(primaryLanguage, Eq("en")); + ASSERT_THAT(primaryLanguage, Eq(u"en")); } TEST_F(QmlProjectItem, GetNotEmptyWidgetApp) @@ -169,14 +169,14 @@ TEST_F(QmlProjectItem, GetNotEmptyShaderToolArgs) auto shaderToolArgs = projectItemNotEmpty->shaderToolArgs(); ASSERT_THAT(shaderToolArgs, - UnorderedElementsAre("-s", "--glsl", "\"100 es,120,150\"", "--hlsl", "50", "--msl", "12")); + UnorderedElementsAre(u"-s", u"--glsl", u"\"100 es,120,150\"", u"--hlsl", u"50", u"--msl", u"12")); } TEST_F(QmlProjectItem, GetNotEmptyShaderToolFiles) { auto shaderToolFiles = projectItemNotEmpty->shaderToolFiles(); - ASSERT_THAT(shaderToolFiles, UnorderedElementsAre("content/shaders/*")); + ASSERT_THAT(shaderToolFiles, UnorderedElementsAre(u"content/shaders/*")); } TEST_F(QmlProjectItem, GetNotEmptyEnvironment) @@ -221,7 +221,7 @@ TEST_F(QmlProjectItem, GetEmptyQtVersion) auto qtVersion = projectItemEmpty->versionQt(); // default Qt Version is "5" for Design Studio projects - ASSERT_THAT(qtVersion, Eq("5")); + ASSERT_THAT(qtVersion, Eq(u"5")); } TEST_F(QmlProjectItem, GetEmptyQtQuickVersion) @@ -338,7 +338,7 @@ TEST_F(QmlProjectItem, SetMainFileProject) auto mainFile = projectItemSetters->mainFile(); - ASSERT_THAT(mainFile, Eq("testing")); + ASSERT_THAT(mainFile, Eq(u"testing")); } TEST_F(QmlProjectItem, SetMainUIFileProject) @@ -347,7 +347,7 @@ TEST_F(QmlProjectItem, SetMainUIFileProject) auto mainUiFile = projectItemSetters->mainUiFile(); - ASSERT_THAT(mainUiFile, Eq("testing")); + ASSERT_THAT(mainUiFile, Eq(u"testing")); } TEST_F(QmlProjectItem, SetImportPaths) @@ -356,7 +356,7 @@ TEST_F(QmlProjectItem, SetImportPaths) auto importPaths = projectItemSetters->importPaths(); - ASSERT_THAT(importPaths, UnorderedElementsAre("testing")); + ASSERT_THAT(importPaths, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, AddImportPaths) @@ -366,7 +366,7 @@ TEST_F(QmlProjectItem, AddImportPaths) auto importPaths = projectItemSetters->importPaths(); - ASSERT_THAT(importPaths, UnorderedElementsAre("testing")); + ASSERT_THAT(importPaths, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, SetFileSelectors) @@ -375,7 +375,7 @@ TEST_F(QmlProjectItem, SetFileSelectors) auto fileSelectors = projectItemSetters->fileSelectors(); - ASSERT_THAT(fileSelectors, UnorderedElementsAre("testing")); + ASSERT_THAT(fileSelectors, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, AddFileSelectors) @@ -385,7 +385,7 @@ TEST_F(QmlProjectItem, AddFileSelectors) auto fileSelectors = projectItemSetters->fileSelectors(); - ASSERT_THAT(fileSelectors, UnorderedElementsAre("testing")); + ASSERT_THAT(fileSelectors, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, SetMultiLanguageSupport) @@ -403,7 +403,7 @@ TEST_F(QmlProjectItem, SetSupportedLanguages) auto supportedLanguages = projectItemSetters->supportedLanguages(); - ASSERT_THAT(supportedLanguages, UnorderedElementsAre("testing")); + ASSERT_THAT(supportedLanguages, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, AddSupportedLanguages) @@ -413,7 +413,7 @@ TEST_F(QmlProjectItem, AddSupportedLanguages) auto supportedLanguages = projectItemSetters->supportedLanguages(); - ASSERT_THAT(supportedLanguages, UnorderedElementsAre("testing")); + ASSERT_THAT(supportedLanguages, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, SetPrimaryLanguage) @@ -423,7 +423,7 @@ TEST_F(QmlProjectItem, SetPrimaryLanguage) auto primaryLanguage = projectItemSetters->primaryLanguage(); ; - ASSERT_THAT(primaryLanguage, Eq("testing")); + ASSERT_THAT(primaryLanguage, Eq(u"testing")); } TEST_F(QmlProjectItem, SetWidgetApp) @@ -441,7 +441,7 @@ TEST_F(QmlProjectItem, SetShaderToolArgs) auto shaderToolArgs = projectItemSetters->shaderToolArgs(); - ASSERT_THAT(shaderToolArgs, UnorderedElementsAre("testing")); + ASSERT_THAT(shaderToolArgs, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, AddShaderToolArgs) @@ -451,7 +451,7 @@ TEST_F(QmlProjectItem, AddShaderToolArgs) auto shaderToolArgs = projectItemSetters->shaderToolArgs(); - ASSERT_THAT(shaderToolArgs, UnorderedElementsAre("testing")); + ASSERT_THAT(shaderToolArgs, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, SetShaderToolFiles) @@ -460,7 +460,7 @@ TEST_F(QmlProjectItem, SetShaderToolFiles) auto shaderToolFiles = projectItemSetters->shaderToolFiles(); - ASSERT_THAT(shaderToolFiles, UnorderedElementsAre("testing")); + ASSERT_THAT(shaderToolFiles, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, AddShaderToolFiles) @@ -470,7 +470,7 @@ TEST_F(QmlProjectItem, AddShaderToolFiles) auto shaderToolFiles = projectItemSetters->shaderToolFiles(); - ASSERT_THAT(shaderToolFiles, UnorderedElementsAre("testing")); + ASSERT_THAT(shaderToolFiles, UnorderedElementsAre(u"testing")); } TEST_F(QmlProjectItem, AddEnvironment)