diff --git a/dist/changelog/changes-12.0.0.md b/dist/changelog/changes-12.0.0.md index 6e96ada76bb..69ab50ee436 100644 --- a/dist/changelog/changes-12.0.0.md +++ b/dist/changelog/changes-12.0.0.md @@ -145,6 +145,12 @@ Editing ### QML +* Fixed multiple crashes when updating the `Outline` view + ([QTCREATORBUG-28862](https://bugreports.qt.io/browse/QTCREATORBUG-28862), + [QTCREATORBUG-29653](https://bugreports.qt.io/browse/QTCREATORBUG-29653), + [QTCREATORBUG-29702](https://bugreports.qt.io/browse/QTCREATORBUG-29702)) +* Fixed that reformatting QML code removed type annotations + ([QTCREATORBUG-29061](https://bugreports.qt.io/browse/QTCREATORBUG-29061)) * Fixed invalid `M325` warnings ([QTCREATORBUG-29601](https://bugreports.qt.io/browse/QTCREATORBUG-29601)) * Language Server @@ -237,6 +243,8 @@ Projects * Fixed issues with the subdirectory structure of the project tree ([QTCREATORBUG-23942](https://bugreports.qt.io/browse/QTCREATORBUG-23942), [QTCREATORBUG-29105](https://bugreports.qt.io/browse/QTCREATORBUG-29105)) +* Fixed an issue with source file specific compiler flags + ([QTCREATORBUG-29707](https://bugreports.qt.io/browse/QTCREATORBUG-29707)) * Presets * Fixed that variables were not expanded for `cmakeExecutable` ([QTCREATORBUG-29643](https://bugreports.qt.io/browse/QTCREATORBUG-29643)) @@ -258,12 +266,19 @@ Projects * Fixed the project tree structure in case of some subfolder structures ([QTCREATORBUG-29733](https://bugreports.qt.io/browse/QTCREATORBUG-29733)) +### Qbs + +* Fixed the importing of builds on macOS + ([QTCREATORBUG-29829](https://bugreports.qt.io/browse/QTCREATORBUG-29829)) + ### vcpkg * Added the generation of code for `CMakeLists.txt` * Added parsing the dependencies from `vcpkg.json` manifest files * Improved the addition of dependencies to `vcpkg.json` +([Documentation](https://doc-snapshots.qt.io/qtcreator-12.0/creator-how-to-edit-vcpkg-manifest-files.html)) + ### Qt Safe Renderer * Added a wizard for Qt Safe Renderer 2.1 and later @@ -277,6 +292,11 @@ Debugging * Added support for remote Linux debugging with LLDB * Fixed warnings about index cache permissions ([QTCREATORBUG-29556](https://bugreports.qt.io/browse/QTCREATORBUG-29556)) +* Pretty Printers + * Fixed `QDateTime` with a time zone offset + ([QTCREATORBUG-29737](https://bugreports.qt.io/browse/QTCREATORBUG-29737)) + * Fixed `std::unique_ptr` on macOS + * Fixed `QImage` Analyzer -------- @@ -323,10 +343,17 @@ Test Integration * Added an option for the number of threads used for scanning ([QTCREATORBUG-29301](https://bugreports.qt.io/browse/QTCREATORBUG-29301)) * Improved the wizards for `GTest` and `Catch2` +* CTest + * Enabled colored test output Platforms --------- +### macOS + +* Fixed running and debugging in an external terminal + ([QTCREATORBUG-29246](https://bugreports.qt.io/browse/QTCREATORBUG-29246)) + ### Android * Fixed issues when `LIBRARY_OUTPUT_DIRECTORY` is set in the CMake build files diff --git a/doc/qtcreator/images/icons/cmake.png b/doc/qtcreator/images/icons/cmake.png new file mode 100644 index 00000000000..bc68b8b467d Binary files /dev/null and b/doc/qtcreator/images/icons/cmake.png differ diff --git a/doc/qtcreator/images/icons/vcpkg.png b/doc/qtcreator/images/icons/vcpkg.png new file mode 100644 index 00000000000..5a0c40aa64d Binary files /dev/null and b/doc/qtcreator/images/icons/vcpkg.png differ diff --git a/doc/qtcreator/images/qt-creator-beautifier-options-general.png b/doc/qtcreator/images/qt-creator-beautifier-options-general.png deleted file mode 100644 index 5a33d6c7abc..00000000000 Binary files a/doc/qtcreator/images/qt-creator-beautifier-options-general.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-baremetal-eblink.png b/doc/qtcreator/images/qtcreator-baremetal-eblink.png deleted file mode 100644 index c372292b524..00000000000 Binary files a/doc/qtcreator/images/qtcreator-baremetal-eblink.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-baremetal-eblink.webp b/doc/qtcreator/images/qtcreator-baremetal-eblink.webp new file mode 100644 index 00000000000..bdd75bd04f6 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-baremetal-eblink.webp differ diff --git a/doc/qtcreator/images/qtcreator-baremetal-jlink.png b/doc/qtcreator/images/qtcreator-baremetal-jlink.png deleted file mode 100644 index 1e221766dde..00000000000 Binary files a/doc/qtcreator/images/qtcreator-baremetal-jlink.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-baremetal-jlink.webp b/doc/qtcreator/images/qtcreator-baremetal-jlink.webp new file mode 100644 index 00000000000..5d1fd1f933a Binary files /dev/null and b/doc/qtcreator/images/qtcreator-baremetal-jlink.webp differ diff --git a/doc/qtcreator/images/qtcreator-baremetal-openocd.png b/doc/qtcreator/images/qtcreator-baremetal-openocd.png deleted file mode 100644 index d84b91ceec9..00000000000 Binary files a/doc/qtcreator/images/qtcreator-baremetal-openocd.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-baremetal-openocd.webp b/doc/qtcreator/images/qtcreator-baremetal-openocd.webp new file mode 100644 index 00000000000..2f04c4f8b19 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-baremetal-openocd.webp differ diff --git a/doc/qtcreator/images/qtcreator-baremetal-stlink.png b/doc/qtcreator/images/qtcreator-baremetal-stlink.png deleted file mode 100644 index f759eb355be..00000000000 Binary files a/doc/qtcreator/images/qtcreator-baremetal-stlink.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-baremetal-stlink.webp b/doc/qtcreator/images/qtcreator-baremetal-stlink.webp new file mode 100644 index 00000000000..3e2502e1e78 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-baremetal-stlink.webp differ diff --git a/doc/qtcreator/images/qtcreator-edit-environment.webp b/doc/qtcreator/images/qtcreator-edit-environment.webp new file mode 100644 index 00000000000..f68eb52540e Binary files /dev/null and b/doc/qtcreator/images/qtcreator-edit-environment.webp differ diff --git a/doc/qtcreator/images/qtcreator-environment-settings-hierarchy.webp b/doc/qtcreator/images/qtcreator-environment-settings-hierarchy.webp new file mode 100644 index 00000000000..574b2a75470 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-environment-settings-hierarchy.webp differ diff --git a/doc/qtcreator/images/qtcreator-gdb-extended-options.png b/doc/qtcreator/images/qtcreator-gdb-extended-options.png deleted file mode 100644 index 10e22f235c1..00000000000 Binary files a/doc/qtcreator/images/qtcreator-gdb-extended-options.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-gdb-options.png b/doc/qtcreator/images/qtcreator-gdb-options.png deleted file mode 100644 index e1ec43cc37b..00000000000 Binary files a/doc/qtcreator/images/qtcreator-gdb-options.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-options-environment-system.png b/doc/qtcreator/images/qtcreator-options-environment-system.png deleted file mode 100644 index 9d6cb599c12..00000000000 Binary files a/doc/qtcreator/images/qtcreator-options-environment-system.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-preferences-beautifier-general.webp b/doc/qtcreator/images/qtcreator-preferences-beautifier-general.webp new file mode 100644 index 00000000000..f416df0f347 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-preferences-beautifier-general.webp differ diff --git a/doc/qtcreator/images/qtcreator-preferences-debugger-gdb.webp b/doc/qtcreator/images/qtcreator-preferences-debugger-gdb.webp new file mode 100644 index 00000000000..9ac81bce223 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-preferences-debugger-gdb.webp differ diff --git a/doc/qtcreator/images/qtcreator-preferences-environment-system.webp b/doc/qtcreator/images/qtcreator-preferences-environment-system.webp new file mode 100644 index 00000000000..9b86064da52 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-preferences-environment-system.webp differ diff --git a/doc/qtcreator/images/qtcreator-projects-environment.webp b/doc/qtcreator/images/qtcreator-projects-environment.webp new file mode 100644 index 00000000000..36011d22263 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-projects-environment.webp differ diff --git a/doc/qtcreator/images/qtcreator-vcpkg-cmake-config.webp b/doc/qtcreator/images/qtcreator-vcpkg-cmake-config.webp new file mode 100644 index 00000000000..fd5be5bb3cc Binary files /dev/null and b/doc/qtcreator/images/qtcreator-vcpkg-cmake-config.webp differ diff --git a/doc/qtcreator/images/qtcreator-vcpkg-manifest-file-editor.webp b/doc/qtcreator/images/qtcreator-vcpkg-manifest-file-editor.webp index 1d341a081f4..485e0ea974e 100644 Binary files a/doc/qtcreator/images/qtcreator-vcpkg-manifest-file-editor.webp 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 index 97295b6b485..966bc3dbc43 100644 Binary files a/doc/qtcreator/images/qtcreator-vcpkg-package-selector.webp and b/doc/qtcreator/images/qtcreator-vcpkg-package-selector.webp differ diff --git a/doc/qtcreator/src/baremetal/creator-baremetal-dev.qdoc b/doc/qtcreator/src/baremetal/creator-baremetal-dev.qdoc index 722cf8d89ba..368e313851a 100644 --- a/doc/qtcreator/src/baremetal/creator-baremetal-dev.qdoc +++ b/doc/qtcreator/src/baremetal/creator-baremetal-dev.qdoc @@ -59,8 +59,9 @@ \section1 Specifying Settings for Debug Server Providers To create connections to bare metal devices using a debug server provider, - select \preferences > \uicontrol Devices - > \uicontrol {Bare Metal} > \uicontrol Add > \uicontrol Default. + select \preferences > \uicontrol Devices > \uicontrol {Bare Metal} > + \uicontrol Add. + The available settings depend on the debug server provider. \section2 EBlink @@ -68,7 +69,7 @@ \l{https://github.com/EmBitz/EBlink}{EBlink} is an ARM Cortex-M debug tool that supports squirrel scripting, live variables, and hot-plugging. - \image qtcreator-baremetal-eblink.png "Bare metal device preferences for EBlink" + \image qtcreator-baremetal-eblink.webp {Bare metal device preferences for EBlink} To specify settings for \EBlink: @@ -105,7 +106,7 @@ \l{https://www.segger.com/products/debug-probes/j-link/}{J-Link} is a line of debug probes by Segger. - \image qtcreator-baremetal-jlink.png "Bare metal device preferences for J-Link" + \image qtcreator-baremetal-jlink.webp "Bare metal device preferences for J-Link" To specify settings for J-Link debug probes: @@ -137,7 +138,7 @@ (JTAG) facility. It enables source level debugging with the GDB compiled for the ARM architecture. - \image qtcreator-baremetal-openocd.png "Bare metal device preferences for OpenOCD" + \image qtcreator-baremetal-openocd.webp "Bare metal device preferences for OpenOCD" To specify settings for \OpenOCD: @@ -163,7 +164,7 @@ \l{https://www.st.com/en/development-tools/stm32-programmers.html#products} {ST-LINK Utility} is used for programming STM32 microcontrollers. - \image qtcreator-baremetal-stlink.png "Bare metal device preferences for St-Link" + \image qtcreator-baremetal-stlink.webp "Bare metal device preferences for St-Link" To specify settings for St-Link: @@ -202,7 +203,7 @@ \image qtcreator-baremetal-uvision-simulator.png "Bare metal device preferences for uVision Simulator" - To specify settings for uVision Simulator or uVision St-Link Debugger: + To specify settings for uVision Simulator: \list 1 @@ -215,11 +216,11 @@ \endlist - \section3 uVision St-Link Debugger + \section3 uVision St-Link or JLink Debugger \image qtcreator-baremetal-uvision-st-link.png "Bare metal device preferences for uVision St-Link" - To specify settings for uVision St-Link Debugger: + To specify settings for uVision St-Link or JLink Debugger: \list 1 diff --git a/doc/qtcreator/src/baremetal/creator-baremetal-settings.qdocinc b/doc/qtcreator/src/baremetal/creator-baremetal-settings.qdocinc index cce6b41d6d4..ea35fe9855b 100644 --- a/doc/qtcreator/src/baremetal/creator-baremetal-settings.qdocinc +++ b/doc/qtcreator/src/baremetal/creator-baremetal-settings.qdocinc @@ -1,4 +1,4 @@ -// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only //! [baremetal-common] @@ -6,6 +6,8 @@ \li In the \uicontrol Name field, enter a name for the connection. \li In the \uicontrol {Startup mode} field, select the mode to start the debug server provider in. + \li In the \uicontrol {Peripheral description file} field, specify a path to + a file that describes the peripherals on the device. \li In the \uicontrol Host field, select the host name and port number to connect to the debug server provider. \li In the \uicontrol {Executable file} field, enter the path to the diff --git a/doc/qtcreator/src/cmake/creator-projects-cmake-building.qdoc b/doc/qtcreator/src/cmake/creator-projects-cmake-building.qdoc index f8c8842b1f5..9c971d24798 100644 --- a/doc/qtcreator/src/cmake/creator-projects-cmake-building.qdoc +++ b/doc/qtcreator/src/cmake/creator-projects-cmake-building.qdoc @@ -88,7 +88,8 @@ the selection, click anywhere in the view. To change the environment variable values for the CMake build environment, - select \uicontrol {Batch Edit}. For more information, see \l{Batch Editing}. + select \uicontrol {Batch Edit}. For more information, see + \l{Batch edit environment settings}. To build using the current configuration, select \uicontrol {Run CMake}. While building, the button text changes to \uicontrol {Stop CMake}. Select diff --git a/doc/qtcreator/src/debugger/creator-only/creator-debugger-settings.qdoc b/doc/qtcreator/src/debugger/creator-only/creator-debugger-settings.qdoc index 06b8d05bc52..4583460cb42 100644 --- a/doc/qtcreator/src/debugger/creator-only/creator-debugger-settings.qdoc +++ b/doc/qtcreator/src/debugger/creator-only/creator-debugger-settings.qdoc @@ -53,7 +53,7 @@ To specify settings for managing the GDB process, select \preferences > \uicontrol Debugger > \uicontrol GDB. - \image qtcreator-gdb-options.png "GDB preferences" + \image qtcreator-preferences-debugger-gdb.webp {GDB preferences} To specify a timeout for terminating non-responsive GDB processes, set the number of seconds to wait in the \uicontrol {GDB timeout} field. The default @@ -111,6 +111,8 @@ To execute arbitrary Python scripts, use \c {python execfile('/path/to/script.py')}. + \section2 Extended GDB Settings + The settings in the \uicontrol Extended group give access to advanced or experimental functions of GDB. Enabling them may negatively impact your debugging experience, so use diff --git a/doc/qtcreator/src/debugger/creator-only/creator-debugger.qdoc b/doc/qtcreator/src/debugger/creator-only/creator-debugger.qdoc index fe61cd19eae..a39e561badd 100644 --- a/doc/qtcreator/src/debugger/creator-only/creator-debugger.qdoc +++ b/doc/qtcreator/src/debugger/creator-only/creator-debugger.qdoc @@ -1368,7 +1368,7 @@ \uicontrol Debugger > \uicontrol GDB > \uicontrol {Load system GDB pretty printers}. For more information, see \l{Specifying GDB Settings}. - \image qtcreator-gdb-options.png {GDB preferences} + \image qtcreator-preferences-debugger-gdb.webp {GDB preferences} \section2 Customizing Built-In Debugging Helpers @@ -2036,7 +2036,7 @@ when loading the same binary in the future. Select \preferences > \uicontrol Debugger > \uicontrol GDB > \uicontrol {Use automatic symbol cache}. - \image qtcreator-gdb-options.png {GDB preferences} + \image qtcreator-preferences-debugger-gdb.webp {GDB preferences} \section2 Minimizing Number of Breakpoints diff --git a/doc/qtcreator/src/editors/creator-code-completion.qdoc b/doc/qtcreator/src/editors/creator-code-completion.qdoc index b3d1830640b..e608400f35d 100644 --- a/doc/qtcreator/src/editors/creator-code-completion.qdoc +++ b/doc/qtcreator/src/editors/creator-code-completion.qdoc @@ -197,12 +197,13 @@ \if defined(qtcreator) Also specify a text string or C++ or QML code construct in the snippet editor, depending on the snippet category. + + You can use \l{Use Qt Creator variables}{predefined variables} in + snippets. \else Also specify a text string or QML code in the snippet editor, depending on the snippet category. \endif - You can use \l{Using Qt Creator Variables}{predefined variables} in - snippets. The snippet editor offers: @@ -299,8 +300,6 @@ \preferences > \uicontrol Nim > \uicontrol Tools, and enter the path to the tool executable in the \uicontrol Path field. - \sa {Document code} - \else - \include qtcreator-variables.qdocinc qtcreator variables + \sa {Document code}, {Use Qt Creator variables} \endif */ diff --git a/doc/qtcreator/src/editors/creator-only/creator-beautifier.qdoc b/doc/qtcreator/src/editors/creator-only/creator-beautifier.qdoc index 84eef9dcc0f..0f0a2d8e67f 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-beautifier.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-beautifier.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 // ********************************************************************** @@ -57,11 +57,11 @@ \li Select \preferences > \uicontrol Beautifier to specify settings for beautifying files. - \li Select the \uicontrol {Enable auto format on file save} check box to + \li Select the \uicontrol {Automatic formatting on file save} check box to automatically beautify files when you save them using the tool you select in the \uicontrol Tool field. - \image qt-creator-beautifier-options-general.png "General Beautifier preferences" + \image qtcreator-preferences-beautifier-general.webp {General Beautifier preferences} \li In the \uicontrol {Restrict to MIME types} field, define the MIME types of the files to beautify, separated by semicolons. Leave the diff --git a/doc/qtcreator/src/editors/creator-only/creator-language-server.qdoc b/doc/qtcreator/src/editors/creator-only/creator-language-server.qdoc index 8ebbaa74d4b..0a89789d4a7 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-language-server.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-language-server.qdoc @@ -81,7 +81,7 @@ \li In the \uicontrol Name field, enter a name for the language server. Select the \inlineimage icons/replace.png (\uicontrol {Variables}) button to use a variable for the server - name. For more information, see \l{Using Qt Creator Variables}. + name. For more information, see \l{Use Qt Creator variables}. \li In the \uicontrol {Language} field, select \uicontrol {Set MIME Types} to select the MIME types of the files to send to the language server. In the field below, you can enter file @@ -113,7 +113,7 @@ \li In the \uicontrol Name field, enter a name for the language server. Select the \inlineimage icons/replace.png (\uicontrol {Variables}) button to use a variable for the server - name. For more information, see \l{Using Qt Creator Variables}. + name. For more information, see \l{Use Qt Creator variables}. \li In the \uicontrol Java field, enter the path to the Java executable. \li In the \uicontrol {Java Language Server} field, enter the path to the Java language server \c .jar file. You can download the Java diff --git a/doc/qtcreator/src/howto/creator-external-tools.qdoc b/doc/qtcreator/src/howto/creator-external-tools.qdoc index 53ba24a3f4b..3f29dfc57bf 100644 --- a/doc/qtcreator/src/howto/creator-external-tools.qdoc +++ b/doc/qtcreator/src/howto/creator-external-tools.qdoc @@ -35,10 +35,12 @@ \image qtcreator-external-tools.png + \if defined(qtcreator) Select the \inlineimage icons/replace.png (\uicontrol {Variables}) button in a field to select from a list of - \l{Using Qt Creator Variables}{variables} that are available in a + \l{Use Qt Creator variables}{variables} that are available in a particular context. + \endif To configure external tools: @@ -71,8 +73,8 @@ \if defined(qtcreator) \li In the \uicontrol {Base environment} field, select whether to run - the tool in the system environment or the \l{Build Environment} - {build environment} or \l {Selecting the Run Environment} + the tool in the system environment or the \l{Specify the environment for projects} + {build environment} or \l {Specify the run environment} {run environment} of the active project. Select the build or run environment if the system environment does not have the necessary PATH settings to find the tool chain, for example. @@ -82,20 +84,12 @@ \li In the \uicontrol Environment field, select \uicontrol Change to modify environment variable values for build and run environments in - the \uicontrol {Edit Environment Changes} dialog. - \if defined(qtcreator) - For more information about how to add and remove variable values, - see \l{Batch Editing}. - \endif - + the \uicontrol {Edit Environment} dialog. To globally change the system environment from the one in which \QC is started, select \preferences > \uicontrol Environment > \uicontrol System, and then select \uicontrol Change in the \uicontrol Environment field. - \if defined(qtcreator) - For more information, see \l{Specifying Environment Settings}. - \endif \li Select the \uicontrol {Modifies current document} check box to make sure that if the current document is modified by the tool, it is saved @@ -121,6 +115,11 @@ configuration file to the folder. \sa {Run QML files}, {Use external text editors}, {Use Qt Linguist} + + \if defined(qtcreator) + \sa {Batch edit environment settings}, {Specify the environment for projects}, + {Use Qt Creator variables} + \endif */ /*! diff --git a/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc b/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc index 94a0f81b0fa..383537b270e 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc @@ -412,7 +412,7 @@ \list 1 \li Select \preferences > \uicontrol Environment > \uicontrol System. - \image qtcreator-options-environment-system.png {System preferences} + \image qtcreator-preferences-environment-system.webp {System preferences} \li In \uicontrol {Maximum number of entries in "Recent Files"}, set the number of files to show. \endlist diff --git a/doc/qtcreator/src/howto/creator-only/creator-vcpkg.qdoc b/doc/qtcreator/src/howto/creator-only/creator-vcpkg.qdoc index dd498be5db8..2a639e1808f 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-vcpkg.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-vcpkg.qdoc @@ -7,7 +7,7 @@ \ingroup creator-reference-build-systems - \title Managing Packages with vcpkg + \title vcpkg Package Manager \brief The experimental vcpkg plugin integrates the vcpkg C/C++ package manager into \QC. @@ -36,16 +36,31 @@ Select \inlineimage icons/online.png to download vcpkg if you have not installed it yet. - \section1 Creating vcpkg Manifest Files + \sa {Create vcpkg manifest files}, {Edit vcpkg manifest files}, + {Enable and disable plugins} +*/ + +/*! + \page creator-how-to-create-vcpkg-manifest-files.html + \previouspage creator-how-tos.html + + \ingroup creator-how-to-projects + + \title Create 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} + \uicontrol vcpkg > \uicontrol {vcpkg.json Manifest File} > + \uicontrol Choose to open the \uicontrol Location dialog. + \li In \uicontrol {File name}, enter a name for the manifest file. + \li In \uicontrol Path, enter the path for the manifest file. + \li Select \uicontrol Next to open the + \uicontrol {vcpkg.json Manifest File} dialog. + \image qtcreator-file-new-file-vcpkg-manifest-file.webp {vcpkg.json Manifest File dialog} \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 {Version string}, 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. @@ -57,27 +72,51 @@ The wizard automatically adds the vcpkg.json file to the CMakeLists.txt file of the project. - \section1 Selecting Packages to Manage + \sa {vcpkg Package Manager}, {Edit vcpkg manifest files} +*/ + +/*! + \page creator-how-to-edit-vcpkg-manifest-files.html + \previouspage creator-how-tos.html + + \ingroup creator-how-to-build + + \title Edit vcpkg manifest files 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} + \section1 Add packages to manage + 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 \inlineimage icons/vcpkg.png + (\uicontrol {Add vcpkg Package}) button on the manifest editor + toolbar. + \image qtcreator-vcpkg-package-selector.webp {Add vcpkg Package 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. + \section1 Generate code for CMake configuration files - \sa {Enable and disable plugins} + To generate sample CMake code to copy to the CMakeLists.text file: + + \list 1 + \li Select the \inlineimage icons/cmake.png (\uicontrol {CMake Code}) + button on the manifest editor toolbar. + \image qtcreator-vcpkg-cmake-config.webp {CMake Code dialog} + \li Select the example code you need and copy-paste it to the + CMakeLists.txt file. + \endlist + + \section1 Set the path to vcpkg + + To set the path to the directory where you installed vcpkg, select + \inlineimage icons/settings.png (\uicontrol Configure) on the editor toolbar. + + \sa {vcpkg Package Manager}, {Create vcpkg manifest files} */ diff --git a/doc/qtcreator/src/ios/creator-ios-dev.qdoc b/doc/qtcreator/src/ios/creator-ios-dev.qdoc index 579e0651740..6c9ca24dfea 100644 --- a/doc/qtcreator/src/ios/creator-ios-dev.qdoc +++ b/doc/qtcreator/src/ios/creator-ios-dev.qdoc @@ -11,6 +11,8 @@ You can connect iOS devices to your local machine with a USB cable to run applications built for them from \QC. + \note Deployment, running, and debugging on iOS 17 devices are not supported. + To be able to use \QC on \macos, you must install Xcode, and therefore, you already have the tool chain for building applications for iOS. \QC automatically detects the tool chain and creates the necessary diff --git a/doc/qtcreator/src/overview/creator-only/creator-mobile-platforms.qdoc b/doc/qtcreator/src/overview/creator-only/creator-mobile-platforms.qdoc index 5b3fbeaecc8..f563a69e382 100644 --- a/doc/qtcreator/src/overview/creator-only/creator-mobile-platforms.qdoc +++ b/doc/qtcreator/src/overview/creator-only/creator-mobile-platforms.qdoc @@ -48,6 +48,8 @@ \section1 iOS + \note Deployment, running, and debugging on iOS 17 devices are not supported. + To be able to use \QC on \macos, you must install Xcode, and therefore you should already have the tool chain for building applications for iOS. \QC automatically detects the tool chain and creates the necessary diff --git a/doc/qtcreator/src/overview/creator-only/creator-supported-platforms.qdoc b/doc/qtcreator/src/overview/creator-only/creator-supported-platforms.qdoc index 5ea6d94a0cf..784dccad4b8 100644 --- a/doc/qtcreator/src/overview/creator-only/creator-supported-platforms.qdoc +++ b/doc/qtcreator/src/overview/creator-only/creator-supported-platforms.qdoc @@ -69,8 +69,7 @@ \li \image ok.png \endtable - \note UWP support was removed from \QC 8.0. - To develop for UWP using Qt 5, use \QC 7.0, or earlier. + \note Deployment, running, and debugging on iOS 17 devices are not supported. \QC automatically runs scheduled checks for updates based on the settings specified in \preferences > \uicontrol Environment > \uicontrol Update. diff --git a/doc/qtcreator/src/projects/creator-only/creator-build-settings-qmake.qdoc b/doc/qtcreator/src/projects/creator-only/creator-build-settings-qmake.qdoc index 2d427ee15aa..ea95ce05924 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-build-settings-qmake.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-build-settings-qmake.qdoc @@ -21,7 +21,7 @@ checkbox. Select the build directory in the \uicontrol {Build Directory} field. You - can use the \l{Using Qt Creator Variables}{variables} that are listed when + can use the \l{Use Qt Creator variables}{variables} that are listed when you select the \inlineimage icons/replace.png (\uicontrol {Variables}) button. 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 21c189a6986..4d9b8b54b9f 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-files-creating.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-files-creating.qdoc @@ -65,8 +65,7 @@ \li Class and script files for Python projects. \row \li \uicontrol {vcpkg} (experimental) - \li \l {Managing Packages with vcpkg}{vcpkg package manager} manifest - files (vcpkg.json). + \li vcpkg package manager manifest files (vcpkg.json). \row \li \uicontrol {Nim} (experimental) \li Empty Nim source and script files. @@ -74,7 +73,7 @@ \sa {Create compiler explorer sessions}, {Create C++ classes}, {Create OpenGL fragment and vertex shaders}, {Create resource files}, - {Use project wizards} + {Create vcpkg manifest files}, {Use project wizards} */ /*! diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-kits.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-kits.qdoc index 3e1f9fcd62e..dc0fe3abc42 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-kits.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-kits.qdoc @@ -151,7 +151,7 @@ \li Select \uicontrol Change to modify environment variable values for build environments in the \uicontrol {Edit Environment Changes} dialog. For more information about how to add and remove variable - values, see \l{Batch Editing}. + values, see \l{Batch edit environment settings}. \row \li \uicontrol {Force UTF-8 MSVC compiler output} \li Either switches the language of MSVC to English or keeps the diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-build.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-build.qdoc index 3a54e8e4e7e..222c7e5d48f 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-build.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-build.qdoc @@ -110,10 +110,8 @@ tested or grouping commands, are not supported because the value of the \uicontrol Executable field is always placed first when constructing the command. - You can use \l {Using Environment Variables}{environment variables} as - values in the fields. In addition, you can \l {Using Qt Creator Variables} - {use \QC variables} in arguments, executable paths, and working - directories. + You can \l {Use Qt Creator variables}{use \QC variables} in arguments, + executable paths, and working directories. \section1 Build Steps diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-environment.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-environment.qdoc index dd3534bb904..504f9d02732 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-environment.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-environment.qdoc @@ -1,16 +1,17 @@ -// 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 /*! - \previouspage creator-build-dependencies.html - \page creator-project-settings-environment.html - \nextpage creator-custom-output-parsers.html + \page creator-how-set-project-environment.html + \previouspage creator-how-tos.html - \title Specifying Environment Settings + \ingroup creator-how-to-projects - You can specify the environment you want to use for building - a project in the \uicontrol {Build Environment} section of - the \uicontrol {Build Settings}. + \title Specify the environment for projects + + The environment for a project is determined according to a settings hierarchy: + + \image qtcreator-environment-settings-hierarchy.webp {Environment settings hierarchy} By default, the environment in which \QC was started is used and modified to include the Qt version. Depending on the selected Qt version, \QC @@ -18,36 +19,109 @@ existing environment variables or add, reset and unset new variables based on your project requirements. - To globally change the system environment from the one in which - \QC is started, select \preferences > - \uicontrol Environment > \uicontrol System, and then select - \uicontrol Change in the \uicontrol Environment field. + The final environment is specified separately for each kit. With + project-specific environment settings you can change the environment for + all kits that you use to build, deploy, and run the project simultaneously, + rather than having to change it separately for each kit. - \image qtcreator-options-environment-system.png "Environment preferences System tab" + The changes are stored in the local project-specific \c{CMakeLists.txt.user} + or \c{.pro.user} file, depending on the build system you use, such as CMake + or qmake. Therefore, they are not suitable for sharing between developers or + development PCs. To share settings, incorporate them into the build system. + For example, if you use CMake, make the changes in the \c {CMakeLists.txt} + file, and if you use qmake, make the changes in the \c{.pro} file. - In addition, you can specify custom environment variables in the - \uicontrol {Project Settings} > \uicontrol Environment settings. - They are added to all build environments. The final build environment - is specified separately for each kit. The project-specific environment - settings enable you to amend the build environment for all kits that - you use to build the project simultaneously, rather than having to edit - it separately for each kit. + \section1 Globally change the environment - \image qtcreator-build-environment.png "Build Environment" + To globally change the environment from the one in which \QC is started, + select \preferences > \uicontrol Environment > \uicontrol System, and then + select \uicontrol Change in the \uicontrol Environment field. - The changes are stored in the local project specific \c{CMakeLists.txt.user} - or \c{.pro.user} file, depending on the build system you use. Therefore, - they are not suitable for sharing between developers or development PCs. To - share settings, incorporate them into the build system. For example, if you - use CMake, make the changes in the \c {CMakeLists.txt} file, and if you use - qmake, make the changes in the \c{.pro} file. + \image qtcreator-preferences-environment-system.webp "Environment preferences System tab" - \section1 Batch Editing + \section1 Change the environment for a project - To modify environment variable values for build or run environments, - select \uicontrol {Batch Edit} in the \uicontrol {Build Environment} - or \uicontrol {Environment} pane and enter environment variables in - the \uicontrol {Edit Environment} dialog. + To change the system environment for a project from the one in which + \QC is started, select \uicontrol Projects > \uicontrol {Project Settings} + > \uicontrol Environment. + + \image qtcreator-projects-environment.webp {Environment tab in Project Settings} + + \section1 Specify the build environment + + Specify the build environment to use for a kit in \uicontrol Projects > + \uicontrol {Build Settings} > \uicontrol {Build Environment}. + + \image qtcreator-build-environment.png {Build Environment section in Build Settings} + + \section2 Clear the build environment + + To build with a clean system environment, select the \uicontrol {Clear + system environment} check box. \QC discards the current environment, and + populates a clean system environment with the environment variables that + the compilers and tools need. Therefore, the environment is never totally + empty, even after you clear it. + + \section1 Specify the run environment + + \QC automatically selects the environment used for running the application + based on the \l{glossary-device}{device} type. You can edit the environment + or select another environment in \uicontrol Projects > + \uicontrol {Run Settings} > \uicontrol {Environment}. + + You can edit existing environment variables or add, reset and unset new + variables. + + \image qtcreator-run-environment.png {Environment section in Run Settings} + + When running on the desktop, the \uicontrol {Build Environment} is used by + default, but you can also use the \uicontrol {System Environment} without the + additions made to the build environment. + + To modify the environment variable values for the run environment, + double-click environment variables or their values and change them inline, + or select \uicontrol {Batch Edit} to change several variable values at a + time. + + \section2 Clean the run environment + + To run in a clean system environment, select \uicontrol {Clean Environment}. + + \section2 Run on devices + + When running on a mobile device connected to the development host, \QC + fetches information about the \uicontrol {Device Environment} from the device. + Usually, it does not make sense to edit the device environment. + + \sa {Batch edit environment settings}, {Specifying Build Settings}, + {Specifying Run Settings}, {Use Qt Creator variables} +*/ + +/*! + \page creator-how-to-batch-edit-environment-settings.html + \previouspage creator-how-tos.html + + \ingroup creator-how-to-projects + + \title Batch edit environment settings + + You can change the environment variable values for build or run environments + either for a particular project or globally for all projects in the + \uicontrol {Edit Environment} dialog: + + \list + \li To change values globally, select \uicontrol Change in the + \l {Globally change the environment}{global environment preferences}. + \li To change values for a project, select \uicontrol {Batch Edit} in the + \l {Change the environment for a project}{project}, + \l {Specify the build environment}{build}, or + \l {Specify the run environment}{run} environment settings. + \endlist + + \image qtcreator-edit-environment.webp {Edit Environment dialog} + + Use the following syntax to enter environment variable names and values: + \c {=}. To remove a variable value from the environment, enter the variable name. For example, \c TEST sets the value of the \c TEST variable empty when @@ -70,21 +144,6 @@ To temporarily disable a variable, add a hash character (#) to the beginning of the line. - \section1 Clearing the System Environment - - To build with a clean system environment, select the \uicontrol {Clear - system environment} check box. \QC discards the current environment, and - populates a clean system environment with the environment variables that - the compilers and tools need. Therefore, the environment is never totally - empty, even after you clear it. - - \section1 Using Environment Variables - - You can use any environment variables in build, deploy, and run - configurations. For a list of variable names, select \uicontrol {Build - Settings} > \uicontrol {Build Environment} > \uicontrol Details. - Environment variables are referenced using the native syntax: $VARNAME - or ${VARNAME} on Unix and %VARNAME% on Windows. - - \include qtcreator-variables.qdocinc qtcreator variables + \sa {Specify the environment for projects}, {Specifying Build Settings}, + {Use Qt Creator variables} */ diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-overview.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-overview.qdoc index 6a15f763200..ab8a2f164ba 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-overview.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-overview.qdoc @@ -14,13 +14,12 @@ \title Configuring Projects - When you install Qt for a target platform, such as Android or QNX, - \l{https://www.qt.io/download-qt-installer}{\QOI} - creates \l{glossary-buildandrun-kit}{kits} for the development - targets. + When you install Qt for a development or target platform, such as Linux, + \macos, Windows, Android or QNX, \l{https://www.qt.io/download-qt-installer} + {\QOI} creates \l{glossary-buildandrun-kit}{kits} for the development targets. - Select the kits to use in the \uicontrol {Configure Projects} - view when you open a project for the first time. At least one kit must be + Select the kits to use for a project in the \uicontrol {Configure Projects} + view when you open the project for the first time. At least one kit must be active. To maintain the list of active kits for a currently open project, switch to @@ -29,7 +28,7 @@ \image qtcreator-projects-kits.webp {Sidebar in the Projects mode} To specify build or run settings for a kit, select \uicontrol Build or - \uicontrol Run below the kit. + \uicontrol Run below the kit name. \section1 Overriding Global Preferences @@ -45,7 +44,7 @@ \li \l{Specify dependencies}{Dependencies} \li \l{Document code}{Documentation Comments} \li \l{Specify editor settings}{Editor} - \li \l{Specifying Environment Settings}{Environment} + \li \l{Specify the environment for projects}{Environment} \li \l{Applying Refactoring Actions}{Quick Fixes} \li \l{To-Do Entries}{To-Do} (experimental) \endlist @@ -69,7 +68,7 @@ lists the kits that are compatible with your project. To activate one or more kits, click them. - \image qtcreator-project-kits.png + \image qtcreator-project-kits.png {List of kits in Projects mode sidebar} The list displays kits from \preferences > \uicontrol Kits. Warning and error icons indicate that the kit configuration diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-desktop.qdocinc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-desktop.qdocinc index caadbe3b463..74e6357ee7b 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-desktop.qdocinc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-desktop.qdocinc @@ -27,7 +27,7 @@ To run with special environment variables set up, select them in the \uicontrol {Run Environment} section. For more information, see - \l {Selecting the Run Environment}. + \l {Specify the run environment}. When building an application, \QC creates a list of directories where the linker will look for libraries that the application links to. By diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run.qdoc index e574c00a4c3..14205f59db2 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run.qdoc @@ -95,31 +95,6 @@ \include creator-projects-settings-run-qnx.qdocinc run settings qnx \include linux-mobile/creator-projects-settings-run-b2qt.qdocinc run settings boot2qt - \section1 Selecting the Run Environment - - \QC automatically selects the environment used for running the application - based on the \l{glossary-device}{device} type. You can edit the environment - or select another environment in the \uicontrol {Run Environment} section. - - You can edit existing environment variables or add, reset and unset new - variables. - - \image qtcreator-run-environment.png {Run Environment section} - - When running on the desktop, the \uicontrol {Build Environment} is used by - default, but you can also use the \uicontrol {System Environment} without the - additions made to the build environment. For more information, see - \l {Build Environment} and \l{Specifying Environment Settings}. - - To run in a clean system environment, select \uicontrol {Clean Environment}. - - When running on a mobile device connected to the development host, \QC - fetches information about the \uicontrol {Device Environment} from the device. - Usually, it does not make sense to edit the device environment. - - To modify the environment variable values for the run environment, select - \uicontrol {Batch Edit}. For more information, see \l{Batch Editing}. - \section1 Specifying a Custom Executable to Run If you use CMake, Meson or the generic project type in \QC, or want diff --git a/doc/qtcreator/src/projects/qtcreator-variables.qdocinc b/doc/qtcreator/src/projects/creator-only/qtcreator-how-to-use-qtc-variables.qdoc similarity index 64% rename from doc/qtcreator/src/projects/qtcreator-variables.qdocinc rename to doc/qtcreator/src/projects/creator-only/qtcreator-how-to-use-qtc-variables.qdoc index eef38706981..cf8100a68ae 100644 --- a/doc/qtcreator/src/projects/qtcreator-variables.qdocinc +++ b/doc/qtcreator/src/projects/creator-only/qtcreator-how-to-use-qtc-variables.qdoc @@ -1,13 +1,19 @@ -// 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 /*! -//! [qtcreator variables] - \section1 Using Qt Creator Variables + \page creator-how-to-use-qtc-variables.html + \previouspage creator-how-tos.html - You can use \QC variables in arguments, executable paths, and working - directories. The variables take care of quoting their expansions, so you do - not need to put them in quotes. + \ingroup creator-how-to-projects + + \title Use Qt Creator variables + + You can use \QC variables in \uicontrol Preferences, + \uicontrol {Build Settings}, and \uicontrol {Run Settings}, in fields that + set arguments, executable paths, and working directories, for example. The + variables take care of quoting their expansions, so you do not need to put + them in quotes. Select the \inlineimage icons/replace.png (\uicontrol {Variables}) button in a field to select from a list of @@ -15,7 +21,7 @@ For more information about each variable, move the cursor over it in the list. - \image qtcreator-variables.png "Qt Creator Variables dialog displaying a tooltip" + \image qtcreator-variables.png {Qt Creator Variables dialog showing a tooltip} The following syntax enables you to use environment variables as \QC variables: %{Env:VARNAME}. @@ -38,7 +44,7 @@ backreferences. For example, if \c %{variable} is \c my123var, then \c %{variable/(..)(\d+)/\2\1} is expanded to \c {123myvar}. - Instead of the forward slash, you can also use the pound sign (\c #) as + Instead of the forward slash, you can also use the number sign (\c #) as the substitution character. This can be helpful if the value is supposed to be a file path, in which case forward slashes might get translated to backslashes on Windows hosts. @@ -48,5 +54,6 @@ \badcode %{variable:-default} \endcode -//! [qtcreator variables] + + \sa {Specify the environment for projects}, {Specifying Build Settings}, */ diff --git a/doc/qtcreator/src/qtcreator-toc.qdoc b/doc/qtcreator/src/qtcreator-toc.qdoc index 0e3f3883d51..ad60462b0f4 100644 --- a/doc/qtcreator/src/qtcreator-toc.qdoc +++ b/doc/qtcreator/src/qtcreator-toc.qdoc @@ -39,7 +39,6 @@ \li \l{Conan Build Configuration} \endlist \li \l{Specifying Run Settings} - \li \l{Specifying Environment Settings} \li \l{Using Custom Output Parsers} \li \l{Sharing Project Settings} \endlist diff --git a/doc/qtcreator/src/user-interface/creator-open-documents-view.qdoc b/doc/qtcreator/src/user-interface/creator-open-documents-view.qdoc index e758c6c2b27..3eb7a3c2d4c 100644 --- a/doc/qtcreator/src/user-interface/creator-open-documents-view.qdoc +++ b/doc/qtcreator/src/user-interface/creator-open-documents-view.qdoc @@ -38,7 +38,7 @@ To set preferences for opening files and handling open files, select \preferences > \uicontrol Environment > \uicontrol System: - \image qtcreator-options-environment-system.png {System tab in Environment preferences} + \image qtcreator-preferences-environment-system.webp {System tab in Environment preferences} \list \li In the \uicontrol {When files are externally modified} field, diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index d2891451e95..008968afc46 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -1282,6 +1282,10 @@ protected: out(ast->rparenToken); if (ast->isArrowFunction && !ast->formals) out("()"); + if (ast->typeAnnotation) { + out(": "); + out(ast->typeAnnotation->type->toString()); + } out(" "); if (ast->isArrowFunction) out("=> "); @@ -1406,6 +1410,10 @@ protected: { for (FormalParameterList *it = ast; it; it = it->next) { accept(it->element); + if (it->element->typeAnnotation) { + out(": "); + out(it->element->typeAnnotation->type->toString()); + } if (it->next) out(", "); } diff --git a/src/libs/solutions/tasking/tasktree.cpp b/src/libs/solutions/tasking/tasktree.cpp index 5dc743f1324..f3fc0ccd9bc 100644 --- a/src/libs/solutions/tasking/tasktree.cpp +++ b/src/libs/solutions/tasking/tasktree.cpp @@ -2728,10 +2728,7 @@ TimeoutTaskAdapter::~TimeoutTaskAdapter() void TimeoutTaskAdapter::start() { - if (*task() == milliseconds::zero()) - QTimer::singleShot(0, this, [this] { emit done(true); }); - else - m_timerId = scheduleTimeout(*task(), this, [this] { m_timerId = {}; emit done(true); }); + m_timerId = scheduleTimeout(*task(), this, [this] { m_timerId = {}; emit done(true); }); } } // namespace Tasking diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp index b14a429ed92..73d37a2eace 100644 --- a/src/libs/utils/aspects.cpp +++ b/src/libs/utils/aspects.cpp @@ -83,6 +83,7 @@ public: bool m_enabled = true; bool m_readOnly = false; bool m_autoApply = true; + bool m_hasEnabler = false; int m_spanX = 1; int m_spanY = 1; BaseAspect::ConfigWidgetCreator m_configWidgetCreator; @@ -347,6 +348,8 @@ void BaseAspect::setEnabler(BoolAspect *checker) { QTC_ASSERT(checker, return); + d->m_hasEnabler = true; + auto update = [this, checker] { BaseAspect::setEnabled(checker->isEnabled() && checker->volatileValue()); }; @@ -646,6 +649,10 @@ void BaseAspect::readSettings() if (settingsKey().isEmpty()) return; QTC_ASSERT(theSettings, return); + // The enabler needs to be set up after reading the settings, otherwise + // changes from reading the settings will not update the enabled state + // because the updates are "quiet". + QTC_CHECK(!d->m_hasEnabler); const QVariant val = theSettings->value(settingsKey()); setVariantValue(val.isValid() ? fromSettingsValue(val) : defaultVariantValue(), BeQuiet); } @@ -1794,8 +1801,6 @@ LayoutItem BoolAspect::adoptButton(QAbstractButton *button) */ void BoolAspect::addToLayout(Layouting::LayoutItem &parent) { - QTC_ASSERT(m_buffer == m_internal, m_buffer = m_internal); - QCheckBox *checkBox = createSubWidget(); addToLayoutHelper(parent, checkBox); bufferToGui(); @@ -1903,7 +1908,6 @@ void SelectionAspect::addToLayout(Layouting::LayoutItem &parent) QTC_CHECK(d->m_buttonGroup == nullptr); QTC_CHECK(!d->m_comboBox); QTC_ASSERT(d->m_buttons.isEmpty(), d->m_buttons.clear()); - QTC_ASSERT(m_buffer == m_internal, m_buffer = m_internal); switch (d->m_displayStyle) { case DisplayStyle::RadioButtons: diff --git a/src/libs/utils/devicefileaccess.cpp b/src/libs/utils/devicefileaccess.cpp index a38a3617a7e..82e6a24a71d 100644 --- a/src/libs/utils/devicefileaccess.cpp +++ b/src/libs/utils/devicefileaccess.cpp @@ -1256,7 +1256,8 @@ bool UnixDeviceFileAccess::iterateWithFind(const FilePath &filePath, void UnixDeviceFileAccess::findUsingLs(const QString ¤t, const FileFilter &filter, - QStringList *found) const + QStringList *found, + const QString &start) const { const RunResult result = runInShell( {"ls", {"-1", "-a", "-p", "--", current}, OsType::OsTypeLinux}); @@ -1265,10 +1266,11 @@ void UnixDeviceFileAccess::findUsingLs(const QString ¤t, const QChar last = entry.back(); if (last == '/') { entry.chop(1); - if (filter.iteratorFlags.testFlag(QDirIterator::Subdirectories)) - findUsingLs(current + '/' + entry, filter, found); + if (filter.iteratorFlags.testFlag(QDirIterator::Subdirectories) && entry != "." + && entry != "..") + findUsingLs(current + '/' + entry, filter, found, start + entry + "/"); } - found->append(entry); + found->append(start + entry); } } @@ -1327,7 +1329,7 @@ void UnixDeviceFileAccess::iterateDirectory(const FilePath &filePath, // if we do not have find - use ls as fallback QStringList entries; - findUsingLs(filePath.path(), filter, &entries); + findUsingLs(filePath.path(), filter, &entries, {}); iterateLsOutput(filePath, entries, filter, callBack); } diff --git a/src/libs/utils/devicefileaccess.h b/src/libs/utils/devicefileaccess.h index 6dddbc70045..5b7c766a8a7 100644 --- a/src/libs/utils/devicefileaccess.h +++ b/src/libs/utils/devicefileaccess.h @@ -183,16 +183,15 @@ protected: expected_str createTempFile(const FilePath &filePath) override; + void findUsingLs(const QString ¤t, + const FileFilter &filter, + QStringList *found, + const QString &start) const; private: - bool iterateWithFind( - const FilePath &filePath, - const FileFilter &filter, - const FilePath::IterateDirCallback &callBack) const; - void findUsingLs( - const QString ¤t, - const FileFilter &filter, - QStringList *found) const; + bool iterateWithFind(const FilePath &filePath, + const FileFilter &filter, + const FilePath::IterateDirCallback &callBack) const; QStringList statArgs(const FilePath &filePath, const QString &linuxFormat, diff --git a/src/libs/utils/externalterminalprocessimpl.cpp b/src/libs/utils/externalterminalprocessimpl.cpp index 5cff874eb76..5182c2c4373 100644 --- a/src/libs/utils/externalterminalprocessimpl.cpp +++ b/src/libs/utils/externalterminalprocessimpl.cpp @@ -8,7 +8,11 @@ #include "terminalcommand.h" #include "utilstr.h" +#include #include +#include + +Q_LOGGING_CATEGORY(log, "terminal.externalprocess", QtWarningMsg) namespace Utils { @@ -17,22 +21,62 @@ ExternalTerminalProcessImpl::ExternalTerminalProcessImpl() setStubCreator(new ProcessStubCreator(this)); } +QString ExternalTerminalProcessImpl::openTerminalScriptAttached() +{ + static const QLatin1String script{R"( +tell application "Terminal" + activate + set windowId to 0 + set newTab to do script "%1 && exit" + + -- Try to get window id + try + -- We have seen this work on macOS 13, and 12.5.1, but not on 14.0 or 14.1 + set windowId to (the id of window 1 where its tab 1 = newTab) as text + on error eMsg number eNum + -- If we get an error we try to generate a known error that will contain the window id in its message + try + set windowId to window of newTab + on error eMsg number eNum + if eNum = -1728 then + try + -- Search for "window id " in the error message, examples of error messages are: + -- „Terminal“ hat einen Fehler erhalten: „window of tab 1 of window id 4018“ kann nicht gelesen werden. + -- Terminal got an error: Can't get window of tab 1 of window id 4707. + set windowIdPrefix to "window id " + set theOffset to (offset of windowIdPrefix in eMsg) + if theOffset = 0 then + log "Failed to parse window id from error message: " & eMsg + else + set windowIdPosition to theOffset + (length of windowIdPrefix) + set windowId to (first word of (text windowIdPosition thru -1 of eMsg)) as integer + end if + on error eMsg2 number eNum2 + log "Failed to parse window id from error message: " & eMsg2 & " (" & eMsg & ") " & theOffset + end try + end if + end try + end try + + repeat until ((count of processes of newTab) = 0) + delay 0.1 + end repeat + + if windowId is not equal to 0 then + close window id windowId + else + log "Cannot close window, sorry." + end if +end tell + )"}; + + return script; +} + ProcessStubCreator::ProcessStubCreator(TerminalInterface *interface) : m_interface(interface) {} -static const QLatin1String TerminalAppScriptAttached{R"( - tell application "Terminal" - activate - set newTab to do script "%1 && exit" - set win to (the id of window 1 where its tab 1 = newTab) as text - repeat until ((count of processes of newTab) = 0) - delay 0.1 - end repeat - close window id win - end tell -)"}; - static const QLatin1String TerminalAppScriptDetached{R"( tell application "Terminal" activate @@ -52,8 +96,15 @@ expected_str ProcessStubCreator::startStubProcess(const ProcessSetupData bool detached = setupData.m_terminalMode == TerminalMode::Detached; if (HostOsInfo::isMacHost()) { + // There is a bug in macOS 14.0 where the script fails if it tries to find + // the window id. We will have to check in future versions of macOS if they fixed + // the issue. + static const QVersionNumber osVersionNumber = QVersionNumber::fromString( + QSysInfo::productVersion()); + static const QMap terminalMap = { - {"Terminal.app", {TerminalAppScriptAttached, TerminalAppScriptDetached}}, + {"Terminal.app", + {ExternalTerminalProcessImpl::openTerminalScriptAttached(), TerminalAppScriptDetached}}, }; if (terminalMap.contains(terminal.command.toString())) { @@ -101,6 +152,17 @@ expected_str ProcessStubCreator::startStubProcess(const ProcessSetupData Tr::tr("Failed to start terminal process: \"%1\".").arg(process->errorString())); } + QObject::connect(process, &Process::readyReadStandardOutput, process, [process] { + const QString output = process->readAllStandardOutput(); + if (!output.isEmpty()) + qCWarning(log).noquote() << output; + }); + QObject::connect(process, &Process::readyReadStandardError, process, [process] { + const QString output = process->readAllStandardError(); + if (!output.isEmpty()) + qCCritical(log).noquote() << output; + }); + QObject::connect(process, &Process::done, m_interface, &TerminalInterface::onStubExited); return 0; diff --git a/src/libs/utils/externalterminalprocessimpl.h b/src/libs/utils/externalterminalprocessimpl.h index cbb3370071b..66d337f963d 100644 --- a/src/libs/utils/externalterminalprocessimpl.h +++ b/src/libs/utils/externalterminalprocessimpl.h @@ -13,6 +13,8 @@ class QTCREATOR_UTILS_EXPORT ExternalTerminalProcessImpl final : public Terminal { public: ExternalTerminalProcessImpl(); + + static QString openTerminalScriptAttached(); }; class QTCREATOR_UTILS_EXPORT ProcessStubCreator : public StubCreator diff --git a/src/libs/utils/terminalinterface.cpp b/src/libs/utils/terminalinterface.cpp index 9fb226ece54..de3f57145cc 100644 --- a/src/libs/utils/terminalinterface.cpp +++ b/src/libs/utils/terminalinterface.cpp @@ -92,6 +92,7 @@ public: StubCreator *stubCreator{nullptr}; const bool waitOnExit; + bool didInferiorRun{false}; }; TerminalInterface::TerminalInterface(bool waitOnExit) @@ -156,6 +157,11 @@ void TerminalInterface::onStubExited() if (d->inferiorProcessId) emitFinished(-1, QProcess::CrashExit); + else if (!d->didInferiorRun) { + emitError(QProcess::FailedToStart, + Tr::tr("Failed to start terminal process. The stub exited before the inferior " + "was started.")); + } } void TerminalInterface::onStubReadyRead() @@ -176,6 +182,7 @@ void TerminalInterface::onStubReadyRead() d->envListFile = nullptr; } else if (out.startsWith("pid ")) { d->inferiorProcessId = out.mid(4).toInt(); + d->didInferiorRun = true; emit started(d->inferiorProcessId, d->inferiorThreadId); } else if (out.startsWith("thread ")) { // Windows only d->inferiorThreadId = out.mid(7).toLongLong(); @@ -349,8 +356,9 @@ void TerminalInterface::start() return; } QTextStream stream(d->envListFile.get()); - finalEnv.forEachEntry([&stream](const QString &key, const QString &value, bool) { - stream << key << '=' << value << '\0'; + finalEnv.forEachEntry([&stream](const QString &key, const QString &value, bool enabled) { + if (enabled) + stream << key << '=' << value << '\0'; }); if (d->envListFile->error() != QFile::NoError) { diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp index 0f93fb7dc75..67b264dcd00 100644 --- a/src/plugins/autotest/autotestplugin.cpp +++ b/src/plugins/autotest/autotestplugin.cpp @@ -136,7 +136,6 @@ AutotestPluginPrivate::AutotestPluginPrivate() TestFrameworkManager::registerTestFramework(&theCatchFramework()); TestFrameworkManager::registerTestTool(&theCTestTool()); - TestFrameworkManager::synchronizeSettings(); m_resultsPane = TestResultsPane::instance(); diff --git a/src/plugins/autotest/boost/boosttestframework.cpp b/src/plugins/autotest/boost/boosttestframework.cpp index 38f800357b4..9addde077b0 100644 --- a/src/plugins/autotest/boost/boosttestframework.cpp +++ b/src/plugins/autotest/boost/boosttestframework.cpp @@ -74,7 +74,6 @@ BoostTestFramework::BoostTestFramework() seed.setLabelText(Tr::tr("Seed:")); seed.setToolTip(Tr::tr("A seed of 0 means no randomization. A value of 1 uses the current " "time, any other value is used as random seed generator.")); - seed.setEnabler(&randomize); randomize.setSettingsKey("Randomize"); randomize.setLabelPlacement(BoolAspect::LabelPlacement::Compact); @@ -96,6 +95,10 @@ BoostTestFramework::BoostTestFramework() memLeaks.setDefaultValue(true); memLeaks.setLabelText(Tr::tr("Detect memory leaks")); memLeaks.setToolTip(Tr::tr("Enable memory leak detection.")); + + readSettings(); + + seed.setEnabler(&randomize); } QString BoostTestFramework::logLevelToOption(const LogLevel logLevel) diff --git a/src/plugins/autotest/catch/catchtestframework.cpp b/src/plugins/autotest/catch/catchtestframework.cpp index 8c312f65d15..a8ac1e9faab 100644 --- a/src/plugins/autotest/catch/catchtestframework.cpp +++ b/src/plugins/autotest/catch/catchtestframework.cpp @@ -49,29 +49,24 @@ CatchFramework::CatchFramework() abortAfter.setSettingsKey("AbortAfter"); abortAfter.setRange(1, 9999); - abortAfter.setEnabler(&abortAfterChecked); benchmarkSamples.setSettingsKey("BenchSamples"); benchmarkSamples.setRange(1, 999999); benchmarkSamples.setDefaultValue(100); - benchmarkSamples.setEnabler(&samplesChecked); benchmarkResamples.setSettingsKey("BenchResamples"); benchmarkResamples.setRange(1, 9999999); benchmarkResamples.setDefaultValue(100000); benchmarkResamples.setToolTip(Tr::tr("Number of resamples for bootstrapping.")); - benchmarkResamples.setEnabler(&resamplesChecked); confidenceInterval.setSettingsKey("BenchConfInt"); confidenceInterval.setRange(0., 1.); confidenceInterval.setSingleStep(0.05); confidenceInterval.setDefaultValue(0.95); - confidenceInterval.setEnabler(&confidenceIntervalChecked); benchmarkWarmupTime.setSettingsKey("BenchWarmup"); benchmarkWarmupTime.setSuffix(Tr::tr(" ms")); benchmarkWarmupTime.setRange(0, 10000); - benchmarkWarmupTime.setEnabler(&warmupChecked); abortAfterChecked.setSettingsKey("AbortChecked"); abortAfterChecked.setLabelText(Tr::tr("Abort after")); @@ -117,6 +112,14 @@ CatchFramework::CatchFramework() warnOnEmpty.setSettingsKey("WarnEmpty"); warnOnEmpty.setLabelText(Tr::tr("Warn on empty tests")); warnOnEmpty.setToolTip(Tr::tr("Warns if a test section does not check any assertion.")); + + readSettings(); + + benchmarkWarmupTime.setEnabler(&warmupChecked); + confidenceInterval.setEnabler(&confidenceIntervalChecked); + benchmarkResamples.setEnabler(&resamplesChecked); + benchmarkSamples.setEnabler(&samplesChecked); + abortAfter.setEnabler(&abortAfterChecked); } ITestParser *CatchFramework::createTestParser() diff --git a/src/plugins/autotest/ctest/ctesttool.cpp b/src/plugins/autotest/ctest/ctesttool.cpp index 2dee957194f..8b82953e2c4 100644 --- a/src/plugins/autotest/ctest/ctesttool.cpp +++ b/src/plugins/autotest/ctest/ctesttool.cpp @@ -108,6 +108,9 @@ CTestTool::CTestTool() threshold.setLabelText(Tr::tr("Threshold")); threshold.setDefaultValue(1); threshold.setRange(1, 128); + + readSettings(); + threshold.setEnabler(&testLoad); } diff --git a/src/plugins/autotest/gtest/gtestframework.cpp b/src/plugins/autotest/gtest/gtestframework.cpp index 191ffc82c29..f07de8ed52a 100644 --- a/src/plugins/autotest/gtest/gtestframework.cpp +++ b/src/plugins/autotest/gtest/gtestframework.cpp @@ -52,7 +52,6 @@ GTestFramework::GTestFramework() iterations.setDefaultValue(1); iterations.setEnabled(false); iterations.setLabelText(Tr::tr("Iterations:")); - iterations.setEnabler(&repeat); seed.setSettingsKey("Seed"); seed.setSpecialValueText({}); @@ -60,7 +59,6 @@ GTestFramework::GTestFramework() seed.setEnabled(false); seed.setLabelText(Tr::tr("Seed:")); seed.setToolTip(Tr::tr("A seed of 0 generates a seed based on the current timestamp.")); - seed.setEnabler(&shuffle); runDisabled.setSettingsKey("RunDisabled"); runDisabled.setLabelText(Tr::tr("Run disabled tests")); @@ -132,6 +130,11 @@ GTestFramework::GTestFramework() connect(this, &AspectContainer::applied, this, [] { TestTreeModel::instance()->rebuild({GTest::Constants::FRAMEWORK_ID}); }); + + readSettings(); + + seed.setEnabler(&shuffle); + iterations.setEnabler(&repeat); } ITestParser *GTestFramework::createTestParser() diff --git a/src/plugins/autotest/qtest/qttestframework.cpp b/src/plugins/autotest/qtest/qttestframework.cpp index a406506a675..0f854ab6f59 100644 --- a/src/plugins/autotest/qtest/qttestframework.cpp +++ b/src/plugins/autotest/qtest/qttestframework.cpp @@ -92,7 +92,6 @@ QtTestFramework::QtTestFramework() maxWarnings.setRange(0, 10000); maxWarnings.setDefaultValue(2000); maxWarnings.setSpecialValueText(Tr::tr("Unlimited")); - maxWarnings.setEnabler(&limitWarnings); quickCheckForDerivedTests.setSettingsKey("QuickCheckForDerivedTests"); quickCheckForDerivedTests.setDefaultValue(false); @@ -100,6 +99,10 @@ QtTestFramework::QtTestFramework() quickCheckForDerivedTests.setToolTip( Tr::tr("Search for Qt Quick tests that are derived from TestCase.\nWarning: Enabling this " "feature significantly increases scan time.")); + + readSettings(); + + maxWarnings.setEnabler(&limitWarnings); } QString QtTestFramework::metricsTypeToOption(const MetricsType type) diff --git a/src/plugins/autotest/testframeworkmanager.cpp b/src/plugins/autotest/testframeworkmanager.cpp index d44dc3d1e7c..7d19e746c8b 100644 --- a/src/plugins/autotest/testframeworkmanager.cpp +++ b/src/plugins/autotest/testframeworkmanager.cpp @@ -86,14 +86,4 @@ ITestTool *testToolForBuildSystemId(Id buildSystemId) }); } -void synchronizeSettings() -{ - Internal::testSettings().fromSettings(); - for (ITestFramework *framework : std::as_const(testFrameworks())) - framework->readSettings(); - - for (ITestTool *testTool : std::as_const(testTools())) - testTool->readSettings(); -} - } // Autotest::TestframeworkManager diff --git a/src/plugins/autotest/testframeworkmanager.h b/src/plugins/autotest/testframeworkmanager.h index 9ced25d8fb9..48f521c863d 100644 --- a/src/plugins/autotest/testframeworkmanager.h +++ b/src/plugins/autotest/testframeworkmanager.h @@ -9,7 +9,6 @@ namespace Autotest::TestFrameworkManager { void registerTestFramework(ITestFramework *framework); void registerTestTool(ITestTool *testTool); -void synchronizeSettings(); ITestFramework *frameworkForId(Utils::Id frameworkId); ITestTool *testToolForId(Utils::Id testToolId); diff --git a/src/plugins/autotest/testsettings.cpp b/src/plugins/autotest/testsettings.cpp index 1d5230d711d..174773b757c 100644 --- a/src/plugins/autotest/testsettings.cpp +++ b/src/plugins/autotest/testsettings.cpp @@ -64,7 +64,6 @@ TestSettings::TestSettings() resultDescriptionMaxSize.setSettingsKey("ResultDescriptionMaxSize"); resultDescriptionMaxSize.setDefaultValue(10); resultDescriptionMaxSize.setRange(1, 100000); - resultDescriptionMaxSize.setEnabler(&limitResultDescription); autoScroll.setSettingsKey("AutoScrollResults"); autoScroll.setDefaultValue(true); @@ -95,7 +94,6 @@ TestSettings::TestSettings() popupOnFail.setSettingsKey("PopupOnFail"); popupOnFail.setLabelText(Tr::tr("Only for unsuccessful test runs")); - popupOnFail.setEnabler(&popupOnFinish); popupOnFail.setToolTip(Tr::tr("Displays test results only if the test run contains " "failed, fatal or unexpectedly passed tests.")); @@ -105,6 +103,11 @@ TestSettings::TestSettings() runAfterBuild.addOption(Tr::tr("None")); runAfterBuild.addOption(Tr::tr("All")); runAfterBuild.addOption(Tr::tr("Selected")); + + fromSettings(); + + resultDescriptionMaxSize.setEnabler(&limitResultDescription); + popupOnFail.setEnabler(&popupOnFinish); } void TestSettings::toSettings() const diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp index a66bf2846a6..de1a7557c83 100644 --- a/src/plugins/boot2qt/qdbplugin.cpp +++ b/src/plugins/boot2qt/qdbplugin.cpp @@ -124,31 +124,7 @@ public: && prj->hasMakeInstallEquivalent(); }); addInitialStep(Qdb::Constants::QdbStopApplicationStepId); - addInitialStep(RemoteLinux::Constants::GenericDeployStepId, [](Target *target) { - auto device = DeviceKitAspect::device(target->kit()); - auto buildDevice = BuildDeviceKitAspect::device(target->kit()); - if (buildDevice && buildDevice->rootPath().needsDevice()) - return false; - return !device || (device - && device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool()); - }); - addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) { - auto device = DeviceKitAspect::device(target->kit()); - auto buildDevice = BuildDeviceKitAspect::device(target->kit()); - if (buildDevice && buildDevice->rootPath().needsDevice()) - return false; - return device && !device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool(); - }); - // This step is for: - // a) A remote build device, as they do not support real rsync yet. - // b) If there is no target device setup yet. - addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) { - auto device = DeviceKitAspect::device(target->kit()); - auto buildDevice = BuildDeviceKitAspect::device(target->kit()); - if (buildDevice && buildDevice->rootPath().needsDevice()) - return true; - return false; - }); + addInitialStep(RemoteLinux::Constants::GenericDeployStepId); } }; diff --git a/src/plugins/clangtools/clangtoolrunner.cpp b/src/plugins/clangtools/clangtoolrunner.cpp index e83037aa536..23c249d3489 100644 --- a/src/plugins/clangtools/clangtoolrunner.cpp +++ b/src/plugins/clangtools/clangtoolrunner.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -76,14 +77,17 @@ static QStringList checksArguments(const AnalyzeInputData &input) return {}; } -static QStringList clangArguments(const ClangDiagnosticConfig &diagnosticConfig, - const QStringList &baseOptions) +static QStringList clangArguments(const AnalyzeInputData &input) { QStringList arguments; + const ClangDiagnosticConfig &diagnosticConfig = input.config; + const QStringList &baseOptions = input.unit.arguments; arguments << ClangDiagnosticConfigsModel::globalDiagnosticOptions() << (isClMode(baseOptions) ? clangArgsForCl(diagnosticConfig.clangOptions()) : diagnosticConfig.clangOptions()) << baseOptions; + if (ProjectFile::isHeader(input.unit.file)) + arguments << "-Wno-pragma-once-outside-header"; if (LOG().isDebugEnabled()) arguments << QLatin1String("-v"); @@ -157,7 +161,7 @@ GroupItem clangToolTask(const AnalyzeInputData &input, const QStringList args = checksArguments(input) + mainToolArguments(data) + QStringList{"--"} - + clangArguments(input.config, input.unit.arguments); + + clangArguments(input); const CommandLine commandLine = {data.executable, args}; qCDebug(LOG).noquote() << "Starting" << commandLine.toUserOutput(); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 370799fe260..be64e7d6656 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -777,6 +777,9 @@ void CMakeBuildStep::updateDeploymentData() IDeviceConstPtr runDevice = DeviceKitAspect::device(buildSystem()->kit()); + if (!runDevice) + return; + const auto appFileNames = transform>(buildSystem()->applicationTargets(), [](const BuildTargetInfo &appTarget) { return appTarget.targetFilePath.fileName(); }); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index b05fbbe9174..febb130a0ac 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -1004,6 +1004,30 @@ void CMakeBuildSystem::updateProjectData() QtSupport::CppKitInfo kitInfo(kit()); QTC_ASSERT(kitInfo.isValid(), return ); + struct QtMajorToPkgNames + { + QtMajorVersion major = QtMajorVersion::None; + QStringList pkgNames; + }; + + auto qtVersionFromCMake = [this](const QList &mapping) { + for (const QtMajorToPkgNames &m : mapping) { + for (const QString &pkgName : m.pkgNames) { + auto qt = m_findPackagesFilesHash.value(pkgName); + if (qt.hasValidTarget()) + return m.major; + } + } + return QtMajorVersion::None; + }; + + QtMajorVersion qtVersion = kitInfo.projectPartQtVersion; + if (qtVersion == QtMajorVersion::None) + qtVersion = qtVersionFromCMake({{QtMajorVersion::Qt6, {"Qt6", "Qt6Core"}}, + {QtMajorVersion::Qt5, {"Qt5", "Qt5Core"}}, + {QtMajorVersion::Qt4, {"Qt4", "Qt4Core"}} + }); + QString errorMessage; RawProjectParts rpps = m_reader.createRawProjectParts(errorMessage); if (!errorMessage.isEmpty()) @@ -1011,8 +1035,7 @@ void CMakeBuildSystem::updateProjectData() qCDebug(cmakeBuildSystemLog) << "Raw project parts created." << errorMessage; for (RawProjectPart &rpp : rpps) { - rpp.setQtVersion( - kitInfo.projectPartQtVersion); // TODO: Check if project actually uses Qt. + rpp.setQtVersion(qtVersion); // TODO: Check if project actually uses Qt. const FilePath includeFileBaseDir = buildConfiguration()->buildDirectory(); QStringList cxxFlags = rpp.flagsForCxx.commandLineFlags; QStringList cFlags = rpp.flagsForC.commandLineFlags; @@ -1769,7 +1792,7 @@ void CMakeBuildSystem::updateQmlJSCodeModel(const QStringList &extraHeaderPaths, auto addImports = [&projectInfo](const QString &imports) { const QStringList importList = CMakeConfigItem::cmakeSplitValue(imports); for (const QString &import : importList) - projectInfo.importPaths.maybeInsert(FilePath::fromString(import), QmlJS::Dialect::Qml); + projectInfo.importPaths.maybeInsert(FilePath::fromUserInput(import), QmlJS::Dialect::Qml); }; const CMakeConfig &cm = configurationFromCMake(); diff --git a/src/plugins/cmakeprojectmanager/presetsmacros.cpp b/src/plugins/cmakeprojectmanager/presetsmacros.cpp index 220d6d6575d..7681d2f7e13 100644 --- a/src/plugins/cmakeprojectmanager/presetsmacros.cpp +++ b/src/plugins/cmakeprojectmanager/presetsmacros.cpp @@ -116,8 +116,10 @@ static Environment getEnvCombined(const std::optional &optPresetEnv Environment result = env; if (optPresetEnv) { - optPresetEnv->forEachEntry([&result](const QString &key, const QString &value, bool) { - result.set(key, value); + optPresetEnv->forEachEntry([&result](const QString &key, const QString &value, + bool enabled) { + if (enabled) + result.set(key, value); }); } @@ -128,7 +130,9 @@ template void expand(const PresetType &preset, Environment &env, const FilePath &sourceDirectory) { const Environment presetEnv = getEnvCombined(preset.environment, env); - presetEnv.forEachEntry([&](const QString &key, const QString &value_, bool) { + presetEnv.forEachEntry([&](const QString &key, const QString &value_, bool enabled) { + if (!enabled) + return; QString value = value_; expandAllButEnv(preset, sourceDirectory, value); value = expandMacroEnv("env", value, [presetEnv](const QString ¯oName) { @@ -163,7 +167,9 @@ template void expand(const PresetType &preset, EnvironmentItems &envItems, const FilePath &sourceDirectory) { const Environment presetEnv = preset.environment ? *preset.environment : Environment(); - presetEnv.forEachEntry([&](const QString &key, const QString &value_, bool) { + presetEnv.forEachEntry([&](const QString &key, const QString &value_, bool enabled) { + if (!enabled) + return; QString value = value_; expandAllButEnv(preset, sourceDirectory, value); value = expandMacroEnv("env", value, [presetEnv](const QString ¯oName) { diff --git a/src/plugins/compilerexplorer/compilerexplorereditor.cpp b/src/plugins/compilerexplorer/compilerexplorereditor.cpp index f71010744ef..25c096c20d9 100644 --- a/src/plugins/compilerexplorer/compilerexplorereditor.cpp +++ b/src/plugins/compilerexplorer/compilerexplorereditor.cpp @@ -209,14 +209,17 @@ SourceEditorWidget::SourceEditorWidget(const std::shared_ptr &se connect(m_codeEditor, &CodeEditorWidget::gotFocus, this, &SourceEditorWidget::gotFocus); - TextDocumentPtr document = TextDocumentPtr(new SourceTextDocument(m_sourceSettings, undoStack)); + auto sourceTextDocument = settings->sourceTextDocument(); + if (!sourceTextDocument) + sourceTextDocument = TextDocumentPtr(new SourceTextDocument(m_sourceSettings, undoStack)); + settings->setSourceTextDocument(sourceTextDocument); - connect(document.get(), + connect(sourceTextDocument.get(), &SourceTextDocument::changed, this, &SourceEditorWidget::sourceCodeChanged); - m_codeEditor->setTextDocument(document); + m_codeEditor->setTextDocument(sourceTextDocument); m_codeEditor->updateHighlighter(); auto addCompilerButton = new QToolButton; diff --git a/src/plugins/compilerexplorer/compilerexplorersettings.h b/src/plugins/compilerexplorer/compilerexplorersettings.h index 64f67122fe6..dc32dbd8c2d 100644 --- a/src/plugins/compilerexplorer/compilerexplorersettings.h +++ b/src/plugins/compilerexplorer/compilerexplorersettings.h @@ -8,6 +8,8 @@ #include +#include + #include namespace CompilerExplorer { @@ -58,6 +60,12 @@ public: ApiConfigFunction apiConfigFunction() const { return m_apiConfigFunction; } + TextEditor::TextDocumentPtr sourceTextDocument() const { return m_sourceTextDocument; } + void setSourceTextDocument(TextEditor::TextDocumentPtr sourceTextDocument) + { + m_sourceTextDocument = sourceTextDocument; + } + public: Utils::StringSelectionAspect languageId{this}; Utils::StringAspect source{this}; @@ -75,6 +83,7 @@ private: private: CompilerExplorerSettings *m_parent; ApiConfigFunction m_apiConfigFunction; + TextEditor::TextDocumentPtr m_sourceTextDocument{nullptr}; }; class CompilerSettings : public Utils::AspectContainer, diff --git a/src/plugins/coreplugin/systemsettings.cpp b/src/plugins/coreplugin/systemsettings.cpp index 1477fcf747d..af4aef29113 100644 --- a/src/plugins/coreplugin/systemsettings.cpp +++ b/src/plugins/coreplugin/systemsettings.cpp @@ -85,7 +85,6 @@ SystemSettings::SystemSettings() autoSaveInterval.setSuffix(Tr::tr("min")); autoSaveInterval.setRange(1, 1000000); autoSaveInterval.setDefaultValue(5); - autoSaveInterval.setEnabler(&autoSaveModifiedFiles); autoSaveInterval.setLabelText(Tr::tr("Interval:")); autoSaveAfterRefactoring.setSettingsKey("EditorManager/AutoSaveAfterRefactoring"); @@ -107,7 +106,6 @@ SystemSettings::SystemSettings() autoSuspendMinDocumentCount.setSettingsKey("EditorManager/AutoSuspendMinDocuments"); autoSuspendMinDocumentCount.setRange(1, 500); autoSuspendMinDocumentCount.setDefaultValue(30); - autoSuspendMinDocumentCount.setEnabler(&autoSuspendEnabled); autoSuspendMinDocumentCount.setLabelText(Tr::tr("Files to keep open:")); autoSuspendMinDocumentCount.setToolTip( Tr::tr("Minimum number of open documents that should be kept in memory. Increasing this " @@ -122,7 +120,6 @@ SystemSettings::SystemSettings() bigFileSizeLimitInMB.setSuffix(Tr::tr("MB")); bigFileSizeLimitInMB.setRange(1, 500); bigFileSizeLimitInMB.setDefaultValue(5); - bigFileSizeLimitInMB.setEnabler(&warnBeforeOpeningBigFiles); maxRecentFiles.setSettingsKey("EditorManager/MaxRecentFiles"); maxRecentFiles.setRange(1, 99); @@ -151,6 +148,11 @@ SystemSettings::SystemSettings() showCrashButton.setSettingsKey("ShowCrashButton"); #endif readSettings(); + + autoSaveInterval.setEnabler(&autoSaveModifiedFiles); + autoSuspendMinDocumentCount.setEnabler(&autoSuspendEnabled); + bigFileSizeLimitInMB.setEnabler(&warnBeforeOpeningBigFiles); + connect(&autoSaveModifiedFiles, &BaseAspect::changed, this, &EditorManagerPrivate::updateAutoSave); connect(&autoSaveInterval, &BaseAspect::changed, this, &EditorManagerPrivate::updateAutoSave); diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp index e72c630cbf7..52f0ea89845 100644 --- a/src/plugins/cppeditor/cppmodelmanager.cpp +++ b/src/plugins/cppeditor/cppmodelmanager.cpp @@ -1647,8 +1647,8 @@ QList CppModelManager::projectPart(const FilePath &fileNa { { QReadLocker locker(&d->m_projectLock); - auto it = d->m_fileToProjectParts.find(fileName); - if (it != d->m_fileToProjectParts.end()) + auto it = d->m_fileToProjectParts.constFind(fileName); + if (it != d->m_fileToProjectParts.constEnd()) return it.value(); } const FilePath canonicalPath = fileName.canonicalPath(); diff --git a/src/plugins/debugger/dap/dapclient.cpp b/src/plugins/debugger/dap/dapclient.cpp index f63d45b2bb9..b5c95c675bd 100644 --- a/src/plugins/debugger/dap/dapclient.cpp +++ b/src/plugins/debugger/dap/dapclient.cpp @@ -58,10 +58,13 @@ void DapClient::sendInitialize() postRequest("initialize", QJsonObject{{"clientID", "QtCreator"}, {"clientName", "QtCreator"}}); } -void DapClient::sendLaunch(const Utils::FilePath &executable) +void DapClient::sendLaunch(const Utils::CommandLine &command) { postRequest("launch", - QJsonObject{{"noDebug", false}, {"program", executable.path()}, {"__restart", ""}}); + QJsonObject{{"noDebug", false}, + {"program", command.executable().path()}, + {"args", command.arguments()}, + {"__restart", ""}}); } void DapClient::sendAttach() diff --git a/src/plugins/debugger/dap/dapclient.h b/src/plugins/debugger/dap/dapclient.h index d2a6f52bb22..8f0603693c2 100644 --- a/src/plugins/debugger/dap/dapclient.h +++ b/src/plugins/debugger/dap/dapclient.h @@ -80,7 +80,7 @@ public: virtual void sendInitialize(); - void sendLaunch(const Utils::FilePath &executable); + void sendLaunch(const Utils::CommandLine &command); void sendAttach(); void sendConfigurationDone(); diff --git a/src/plugins/debugger/dap/dapengine.cpp b/src/plugins/debugger/dap/dapengine.cpp index b39e664f211..8dcbb89dd7e 100644 --- a/src/plugins/debugger/dap/dapengine.cpp +++ b/src/plugins/debugger/dap/dapengine.cpp @@ -195,7 +195,7 @@ void DapEngine::handleDapInitialize() { QTC_ASSERT(state() == EngineRunRequested, qCDebug(logCategory()) << state()); - m_dapClient->sendLaunch(runParameters().inferior.command.executable()); + m_dapClient->sendLaunch(runParameters().inferior.command); qCDebug(logCategory()) << "handleDapLaunch"; } @@ -523,6 +523,9 @@ QString DapEngine::errorMessage(QProcess::ProcessError error) const void DapEngine::handleDapDone() { + if (state() == DebuggerFinished) + return; + if (m_dapClient->dataProvider()->result() == ProcessResult::StartFailed) { notifyEngineSetupFailed(); showMessage("ADAPTER START FAILED"); @@ -812,7 +815,7 @@ void DapEngine::refreshLocals(const QJsonArray &variables) if (currentItem && currentItem->iname.startsWith("watch")) currentItem->removeChildren(); - for (auto variable : variables) { + for (const auto &variable : variables) { WatchItem *item = new WatchItem; const QString name = variable.toObject().value("name").toString(); diff --git a/src/plugins/debugger/dap/gdbdapengine.cpp b/src/plugins/debugger/dap/gdbdapengine.cpp index 3934aebe9d8..d927de6bad4 100644 --- a/src/plugins/debugger/dap/gdbdapengine.cpp +++ b/src/plugins/debugger/dap/gdbdapengine.cpp @@ -55,6 +55,8 @@ public: void start() override { m_proc.setProcessMode(ProcessMode::Writer); + if (m_runParameters.debugger.workingDirectory.isDir()) + m_proc.setWorkingDirectory(m_runParameters.debugger.workingDirectory); m_proc.setEnvironment(m_runParameters.debugger.environment); m_proc.setCommand(m_cmd); m_proc.start(); diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 7dc014eadaf..03e6c0f00e8 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -662,9 +662,11 @@ CommandLine DockerDevicePrivate::withDockerExecCmd(const CommandLine &cmd, dockerCmd.addArg("-t"); if (env) { - env->forEachEntry([&](const QString &key, const QString &value, bool) { - dockerCmd.addArg("-e"); - dockerCmd.addArg(key + "=" + env->expandVariables(value)); + env->forEachEntry([&](const QString &key, const QString &value, bool enabled) { + if (enabled) { + dockerCmd.addArg("-e"); + dockerCmd.addArg(key + "=" + env->expandVariables(value)); + } }); } diff --git a/src/plugins/fakevim/fakevimactions.cpp b/src/plugins/fakevim/fakevimactions.cpp index b4d568c7f07..a7c0eee43a2 100644 --- a/src/plugins/fakevim/fakevimactions.cpp +++ b/src/plugins/fakevim/fakevimactions.cpp @@ -156,8 +156,6 @@ FakeVimSettings::FakeVimSettings() Row ints { shiftWidth, tabStop, scrollOff, st }; - vimRcPath.setEnabler(&readVimRc); - Column strings { backspace, isKeyword, @@ -239,6 +237,8 @@ FakeVimSettings::FakeVimSettings() readSettings(); + vimRcPath.setEnabler(&readVimRc); + #endif } diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index 976704fed5b..def0016f3ab 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -592,6 +592,11 @@ bool Client::reachable() const return d->m_state == Initialized; } +void Client::resetRestartCounter() +{ + d->m_restartsLeft = ClientPrivate::MaxRestarts; +} + void Client::setClientInfo(const LanguageServerProtocol::ClientInfo &clientInfo) { d->m_clientInfo = clientInfo; diff --git a/src/plugins/languageclient/client.h b/src/plugins/languageclient/client.h index aba2b996754..fdeb1356d6c 100644 --- a/src/plugins/languageclient/client.h +++ b/src/plugins/languageclient/client.h @@ -86,6 +86,7 @@ public: State state() const; QString stateString() const; bool reachable() const; + void resetRestartCounter(); void setClientInfo(const LanguageServerProtocol::ClientInfo &clientInfo); // capabilities diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp index bb655e2d8f8..81838357bb9 100644 --- a/src/plugins/languageclient/languageclientmanager.cpp +++ b/src/plugins/languageclient/languageclientmanager.cpp @@ -159,6 +159,7 @@ void LanguageClientManager::clientFinished(Client *client) QTC_ASSERT(managerInstance, return); if (managerInstance->m_restartingClients.remove(client)) { + client->resetRestartCounter(); client->reset(); client->start(); return; diff --git a/src/plugins/projectexplorer/headerpath.h b/src/plugins/projectexplorer/headerpath.h index f46d1ad401e..6df25245424 100644 --- a/src/plugins/projectexplorer/headerpath.h +++ b/src/plugins/projectexplorer/headerpath.h @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -22,7 +23,8 @@ class HeaderPath { public: HeaderPath() = default; - HeaderPath(const QString &path, HeaderPathType type) : path(path), type(type) { } + HeaderPath(const QString &path, HeaderPathType type) + : path(QDir::fromNativeSeparators(path)), type(type) { } HeaderPath(const char *path, HeaderPathType type) : HeaderPath(QLatin1String(path), type) {} HeaderPath(const Utils::FilePath &path, HeaderPathType type) : HeaderPath(path.path(), type) diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 53639778950..027aa5d2101 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -867,8 +867,9 @@ QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFi rootProFileName, deviceRoot()); - env.forEachEntry([&](const QString &key, const QString &value, bool) { - m_qmakeGlobals->environment.insert(key, env.expandVariables(value)); + env.forEachEntry([&](const QString &key, const QString &value, bool enabled) { + if (enabled) + m_qmakeGlobals->environment.insert(key, env.expandVariables(value)); }); m_qmakeGlobals->setCommandLineArguments(rootProFileName, qmakeArgs); diff --git a/src/plugins/qmlprofiler/qmlprofilersettings.cpp b/src/plugins/qmlprofiler/qmlprofilersettings.cpp index 9bbac157414..32063ec947b 100644 --- a/src/plugins/qmlprofiler/qmlprofilersettings.cpp +++ b/src/plugins/qmlprofiler/qmlprofilersettings.cpp @@ -40,7 +40,6 @@ QmlProfilerSettings::QmlProfilerSettings() flushInterval.setRange(1, 10000000); flushInterval.setDefaultValue(1000); flushInterval.setLabelText(Tr::tr("Flush interval (ms):")); - flushInterval.setEnabler(&flushEnabled); lastTraceFile.setSettingsKey("Analyzer.QmlProfiler.LastTraceFile"); @@ -63,6 +62,8 @@ QmlProfilerSettings::QmlProfilerSettings() }); readSettings(); + + flushInterval.setEnabler(&flushEnabled); } // QmlProfilerSettingsPage diff --git a/src/plugins/qtsupport/codegensettings.cpp b/src/plugins/qtsupport/codegensettings.cpp index 007467e619d..ec956dc09bb 100644 --- a/src/plugins/qtsupport/codegensettings.cpp +++ b/src/plugins/qtsupport/codegensettings.cpp @@ -41,7 +41,6 @@ CodeGenSettings::CodeGenSettings() addQtVersionCheck.setSettingsKey("AddQtVersionCheck"); addQtVersionCheck.setLabelText(Tr::tr("Add Qt version #ifdef for module names")); - addQtVersionCheck.setEnabler(&includeQtModule); setLayouter([this] { using namespace Layouting; @@ -66,6 +65,7 @@ CodeGenSettings::CodeGenSettings() readSettings(); + addQtVersionCheck.setEnabler(&includeQtModule); } class CodeGenSettingsPage final : public Core::IOptionsPage diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 565b0675503..3f875f1ef4b 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -768,8 +768,9 @@ CommandLine SshProcessInterfacePrivate::fullLocalCommandLine() const inner.addArgs(QString("echo ") + s_pidMarker + "$$" + s_pidMarker + " && ", CommandLine::Raw); const Environment &env = q->m_setup.m_environment; - env.forEachEntry([&](const QString &key, const QString &value, bool) { - inner.addArgs(key + "='" + env.expandVariables(value) + '\'', CommandLine::Raw); + env.forEachEntry([&](const QString &key, const QString &value, bool enabled) { + if (enabled) + inner.addArgs(key + "='" + env.expandVariables(value) + '\'', CommandLine::Raw); }); if (!useTerminal && !commandLine.isEmpty()) diff --git a/src/plugins/screenrecorder/screenrecordersettings.cpp b/src/plugins/screenrecorder/screenrecordersettings.cpp index cc00f6da065..0a94638f855 100644 --- a/src/plugins/screenrecorder/screenrecordersettings.cpp +++ b/src/plugins/screenrecorder/screenrecordersettings.cpp @@ -113,7 +113,6 @@ ScreenRecorderSettings::ScreenRecorderSettings() fileSizeLimit.setDefaultValue(1024); fileSizeLimit.setRange(100, 1024 * 1024 * 2); // Up to 2GB fileSizeLimit.setSuffix("MB"); - fileSizeLimit.setEnabler(&enableFileSizeLimit); enableRtBuffer.setSettingsKey("EnableRealTimeBuffer"); enableRtBuffer.setDefaultValue(true); @@ -124,7 +123,6 @@ ScreenRecorderSettings::ScreenRecorderSettings() rtBufferSize.setDefaultValue(1024); rtBufferSize.setRange(100, 1024 * 1024 * 2); // Up to 2GB rtBufferSize.setSuffix("MB"); - rtBufferSize.setEnabler(&enableRtBuffer); logFfmpegCommandline.setSettingsKey("LogFFMpegCommandLine"); logFfmpegCommandline.setDefaultValue(false); @@ -206,6 +204,9 @@ ScreenRecorderSettings::ScreenRecorderSettings() readSettings(); + rtBufferSize.setEnabler(&enableRtBuffer); + fileSizeLimit.setEnabler(&enableFileSizeLimit); + setCaptureMouseClicksVisible(); connect(&screenCaptureType, &SelectionAspect::volatileValueChanged, this, setCaptureMouseClicksVisible); diff --git a/src/plugins/texteditor/CMakeLists.txt b/src/plugins/texteditor/CMakeLists.txt index 03efc189224..7d4577413bc 100644 --- a/src/plugins/texteditor/CMakeLists.txt +++ b/src/plugins/texteditor/CMakeLists.txt @@ -103,7 +103,6 @@ add_qtc_plugin(TextEditor texteditor.qrc texteditor_global.h texteditortr.h - texteditor_p.h texteditoractionhandler.cpp texteditoractionhandler.h texteditorconstants.cpp texteditorconstants.h texteditoroverlay.cpp texteditoroverlay.h diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp index 2c462127026..8c736a45396 100644 --- a/src/plugins/texteditor/outlinefactory.cpp +++ b/src/plugins/texteditor/outlinefactory.cpp @@ -120,8 +120,10 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) : m_toggleSort->setToolTip(Tr::tr("Sort Alphabetically")); connect(m_toggleSort, &QAbstractButton::clicked, this, &OutlineWidgetStack::toggleSort); - connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, - this, &OutlineWidgetStack::updateEditor); + connect(Core::EditorManager::instance(), + &Core::EditorManager::currentEditorChanged, + this, + &OutlineWidgetStack::updateCurrentEditor); connect(factory, &OutlineFactory::updateOutline, this, &OutlineWidgetStack::updateCurrentEditor); updateCurrentEditor(); diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 1a30c3af98e..7723fc0bc41 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -27,7 +27,6 @@ #include "tabsettings.h" #include "textdocument.h" #include "textdocumentlayout.h" -#include "texteditor_p.h" #include "texteditoractionhandler.h" #include "texteditorconstants.h" #include "texteditoroverlay.h" @@ -563,6 +562,19 @@ struct PaintEventBlockData struct ExtraAreaPaintEventData; +struct TextEditorPrivateHighlightBlocks +{ + QList open; + QList close; + QList visualIndent; + inline int count() const { return visualIndent.size(); } + inline bool isEmpty() const { return open.isEmpty() || close.isEmpty() || visualIndent.isEmpty(); } + inline bool operator==(const TextEditorPrivateHighlightBlocks &o) const { + return (open == o.open && close == o.close && visualIndent == o.visualIndent); + } + inline bool operator!=(const TextEditorPrivateHighlightBlocks &o) const { return !(*this == o); } +}; + class TextEditorWidgetPrivate : public QObject { public: diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs index a041fbcaa66..0c25f5bf5c6 100644 --- a/src/plugins/texteditor/texteditor.qbs +++ b/src/plugins/texteditor/texteditor.qbs @@ -134,7 +134,6 @@ QtcPlugin { "texteditor.h", "texteditor.qrc", "texteditor_global.h", "texteditortr.h", - "texteditor_p.h", "texteditoractionhandler.cpp", "texteditoractionhandler.h", "texteditorconstants.cpp", diff --git a/src/plugins/texteditor/texteditor_p.h b/src/plugins/texteditor/texteditor_p.h deleted file mode 100644 index fa8232a0fb0..00000000000 --- a/src/plugins/texteditor/texteditor_p.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - - -#include "texteditor_global.h" - -#include -#include - -namespace TextEditor { - -class TextDocument; - -namespace Internal { - -// -// TextEditorPrivate -// - -struct TextEditorPrivateHighlightBlocks -{ - QList open; - QList close; - QList visualIndent; - inline int count() const { return visualIndent.size(); } - inline bool isEmpty() const { return open.isEmpty() || close.isEmpty() || visualIndent.isEmpty(); } - inline bool operator==(const TextEditorPrivateHighlightBlocks &o) const { - return (open == o.open && close == o.close && visualIndent == o.visualIndent); - } - inline bool operator!=(const TextEditorPrivateHighlightBlocks &o) const { return !(*this == o); } -}; - -} // namespace Internal -} // namespace TextEditor diff --git a/tests/auto/qml/reformatter/tst_reformatter.cpp b/tests/auto/qml/reformatter/tst_reformatter.cpp index 36c8f2a83e8..748b8b81263 100644 --- a/tests/auto/qml/reformatter/tst_reformatter.cpp +++ b/tests/auto/qml/reformatter/tst_reformatter.cpp @@ -28,6 +28,11 @@ public: private slots: void test(); void test_data(); + + void reformatter_data(); + void reformatter(); + +private: }; tst_Reformatter::tst_Reformatter() @@ -41,10 +46,18 @@ void tst_Reformatter::test_data() { QTest::addColumn("path"); + // This test performs line-by-line comparison and fails if reformatting + // makes a change inline, for example whitespace removal. We omit + // those files in this test. + QSet excludedFiles; + excludedFiles << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.qml"; + excludedFiles << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.formatted.qml"; + QDirIterator it(TESTSRCDIR, QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"), QDir::Files); while (it.hasNext()) { const QString fileName = it.next(); - QTest::newRow(fileName.toLatin1()) << it.filePath(); + if (!excludedFiles.contains(fileName)) + QTest::newRow(fileName.toLatin1()) << it.filePath(); } } @@ -84,6 +97,44 @@ void tst_Reformatter::test() QCOMPARE(sourceLines.size(), newLines.size()); } +void tst_Reformatter::reformatter_data() +{ + QTest::addColumn("filePath"); + QTest::addColumn("formattedFilePath"); + + QTest::newRow("typeAnnotations") + << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.qml" + << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.formatted.qml"; +} + +void tst_Reformatter::reformatter() +{ + QFETCH(QString, filePath); + QFETCH(QString, formattedFilePath); + + Utils::FilePath fPath = Utils::FilePath::fromString(filePath); + Document::MutablePtr doc + = Document::create(fPath, ModelManagerInterface::guessLanguageOfFile(fPath)); + + QString fileContent; + { + QFile file(filePath); + QVERIFY(file.open(QFile::ReadOnly | QFile::Text)); + fileContent = QString::fromUtf8(file.readAll()); + } + doc->setSource(fileContent); + doc->parse(); + QString expected; + { + QFile file(formattedFilePath); + QVERIFY(file.open(QFile::ReadOnly | QFile::Text)); + expected = QString::fromUtf8(file.readAll()); + } + + QString formatted = reformat(doc); + QCOMPARE(formatted, expected); +} + QTEST_GUILESS_MAIN(tst_Reformatter); #include "tst_reformatter.moc" diff --git a/tests/auto/qml/reformatter/typeAnnotations.formatted.qml b/tests/auto/qml/reformatter/typeAnnotations.formatted.qml new file mode 100644 index 00000000000..208aa25cd9a --- /dev/null +++ b/tests/auto/qml/reformatter/typeAnnotations.formatted.qml @@ -0,0 +1,18 @@ + +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +import QtQuick + +Text { + function aaa(t: int, k: double): int { + return 42 + } + + function bbb(aaa): int { + return 42 + } + + function abc(cba: int) { + return 42 + } +} diff --git a/tests/auto/qml/reformatter/typeAnnotations.qml b/tests/auto/qml/reformatter/typeAnnotations.qml new file mode 100644 index 00000000000..af0d93b3de7 --- /dev/null +++ b/tests/auto/qml/reformatter/typeAnnotations.qml @@ -0,0 +1,17 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick + +Text { + function aaa (t : int, k : double) : int { + return 42; + } + + function bbb(aaa) + : int {return 42} + + function abc (cba : int) { + return 42; + } +} diff --git a/tests/auto/utils/unixdevicefileaccess/tst_unixdevicefileaccess.cpp b/tests/auto/utils/unixdevicefileaccess/tst_unixdevicefileaccess.cpp index 5eba8122241..a55577ef05e 100644 --- a/tests/auto/utils/unixdevicefileaccess/tst_unixdevicefileaccess.cpp +++ b/tests/auto/utils/unixdevicefileaccess/tst_unixdevicefileaccess.cpp @@ -48,6 +48,11 @@ public: p.waitForFinished(); return {p.exitCode(), p.readAllStandardOutput(), p.readAllStandardError()}; } + + void findUsingLs(const QString ¤t, const FileFilter &filter, QStringList *found) + { + UnixDeviceFileAccess::findUsingLs(current, filter, found, {}); + } }; class tst_unixdevicefileaccess : public QObject @@ -69,6 +74,27 @@ private slots: QCOMPARE(size, 1024); } + void findUsingLs() + { + QStringList result; + m_dfa.findUsingLs(m_tempDir.path(), + {{}, QDir::NoFilter, QDirIterator::Subdirectories}, + &result); + + QCOMPARE(result, QStringList({".", "..", "size-test"})); + + QDir tDir(m_tempDir.path()); + tDir.mkdir("lsfindsubdir"); + + result.clear(); + m_dfa.findUsingLs(m_tempDir.path(), + {{}, QDir::NoFilter, QDirIterator::Subdirectories}, + &result); + QCOMPARE(result, + QStringList( + {".", "..", "lsfindsubdir/.", "lsfindsubdir/..", "lsfindsubdir", "size-test"})); + } + private: TestDFA m_dfa; DeviceFileAccess *m_dfaPtr = &m_dfa; diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt index de324714a2b..1d145e1e8bb 100644 --- a/tests/manual/CMakeLists.txt +++ b/tests/manual/CMakeLists.txt @@ -12,6 +12,7 @@ add_subdirectory(fakevim) # add_subdirectory(genericproject) add_subdirectory(pluginview) add_subdirectory(proparser) +add_subdirectory(terminal) # add_subdirectory(qml) # add_subdirectory(qt4projectmanager) # add_subdirectory(search) diff --git a/tests/manual/manual.qbs b/tests/manual/manual.qbs index ba774823c12..25ed3b9e183 100644 --- a/tests/manual/manual.qbs +++ b/tests/manual/manual.qbs @@ -15,6 +15,7 @@ Project { "subdirfilecontainer/subdirfilecontainer.qbs", "tasking/demo/demo.qbs", "tasking/imagescaling/imagescaling.qbs", + "terminal/terminal.qbs", "widgets/widgets.qbs", ] } diff --git a/tests/manual/terminal/CMakeLists.txt b/tests/manual/terminal/CMakeLists.txt new file mode 100644 index 00000000000..409cba4d706 --- /dev/null +++ b/tests/manual/terminal/CMakeLists.txt @@ -0,0 +1,5 @@ +add_qtc_test(tst_terminal + MANUALTEST + DEPENDS Utils + SOURCES tst_terminal.cpp +) diff --git a/tests/manual/terminal/terminal.qbs b/tests/manual/terminal/terminal.qbs new file mode 100644 index 00000000000..a9bea16872f --- /dev/null +++ b/tests/manual/terminal/terminal.qbs @@ -0,0 +1,7 @@ +import qbs + +QtcManualTest { + name: "Terminal autotest" + Depends { name: "Utils" } + files: "tst_terminal.cpp" +} diff --git a/tests/manual/terminal/tst_terminal.cpp b/tests/manual/terminal/tst_terminal.cpp new file mode 100644 index 00000000000..921fdbc577a --- /dev/null +++ b/tests/manual/terminal/tst_terminal.cpp @@ -0,0 +1,54 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include + +#include +#include + +//TESTED_COMPONENT=src/utils/changeset + +class tst_Terminal : public QObject +{ + Q_OBJECT + +private slots: + void terminalApp() + { + if (!Utils::HostOsInfo::isMacHost()) + QSKIP("This test is only for macOS"); + + int rnd = QRandomGenerator::global()->generate(); + QString testCode = R"( +set theFile to POSIX file "/tmp/testoutput.txt" +set theFile to theFile as string +set theOpenedFile to open for access file theFile with write permission +set eof of theOpenedFile to 0 +write "%1" to theOpenedFile starting at eof +close access theOpenedFile + )"; + QString terminalScript = Utils::ExternalTerminalProcessImpl::openTerminalScriptAttached(); + terminalScript = terminalScript.arg("sleep 1") + "\n" + testCode.arg(rnd); + + QProcess process; + process.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels); + process.setProgram("osascript"); + process.setArguments({"-e", terminalScript}); + + process.start(); + + QTRY_VERIFY(process.state() == QProcess::NotRunning); + const auto output = process.readAll(); + if (!output.isEmpty()) + qDebug() << "Output:" << output; + QVERIFY(process.exitCode() == 0); + + QFile testOutputFile("/tmp/testoutput.txt"); + QVERIFY(testOutputFile.open(QIODevice::ReadOnly)); + QVERIFY(testOutputFile.readAll() == QByteArray::number(rnd)); + } +}; + +QTEST_GUILESS_MAIN(tst_Terminal) + +#include "tst_terminal.moc"