Merge remote-tracking branch 'origin/11.0'

Change-Id: I87b22a73427cf9fc1b96075dc0db769ed3d3621c
This commit is contained in:
Eike Ziller
2023-06-09 11:24:29 +02:00
269 changed files with 2821 additions and 1503 deletions

View File

@@ -14,6 +14,7 @@ General
-------
* Added a `Terminal` view (QTCREATORBUG-8511)
([Documentation](https://doc-snapshots.qt.io/qtcreator-11.0/creator-output-panes.html#terminal))
* Opt-out via `Preferences` > `Terminal` preferences
* Added support for
* different shells, colors, fonts, and multiple tabs
@@ -53,6 +54,7 @@ Editing
* Added experimental support for GitHub Copilot
([GitHub documentation](https://github.com/features/copilot))
([Qt Creator documentation](https://doc-snapshots.qt.io/qtcreator-11.0/creator-copilot.html))
* Added missing actions for opening the `Call Hierarchy` (QTCREATORBUG-28839,
QTCREATORBUG-28842)

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -29,6 +29,12 @@
\if defined(qtcreator)
\image qtcreator-editortoolbar-symbols.webp {Edit mode toolbar}
To add more space around the toolbar items, select \uicontrol Edit >
\uicontrol Preferences > \uicontrol Environment > \uicontrol Interface, and
then select \uicontrol Relaxed in the \uicontrol {Toolbar style} field.
\image qtcreator-preferences-environment-interface.webp {Interface tab in Environment preferences}
\else
\image studio-edit-mode.png
\endif

View File

@@ -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
// **********************************************************************
@@ -79,6 +79,19 @@
programming languages besides C++. In addition, it integrates
diagnostics from the language server.
\li \l {Using GitHub Copilot}
The experimental Copilot plugin integrates
\l{https://github.com/features/copilot}{GitHub Copilot} into \QC.
You can view suggestions from Copilot in the code editor.
\li \l{Developing Qt for Python Applications}
To support developing Qt for Python applications, \QC lets you
set up Qt for Python, use project wizards to create Qt for
Python applications, write Python code, and run and debug the
applications.
\li \l{Editing MIME Types}
\QC uses the MIME type of a file to determine which mode and editor

View File

@@ -74,6 +74,11 @@
\section2 Locating Files
You can locate files in the local file system or on connected devices. By
default, the file system filter shows the files in the same folder as the
currently open file and lets you navigate the file system. Also, it shows
items that let you switch to another device root.
For example, to open a QML file called \e HelloWorld.qml in the currently
open project using the locator:
@@ -143,16 +148,19 @@
such as \c {Utils::*View}.
\endif
\section2 Creating Files from Locator
\section2 Creating Files and Directories from Locator
To create a new file and open it in the editor, type \c f
followed by \key Space, followed by path and file name, and then press
\key Enter.
\key Enter or select \uicontrol {Create and Open File}. To create a
directory, select \uicontrol {Create Directory}.
\section2 Opening Sessions from Locator
You can use the filter that triggers menu commands to open
\l{Managing Sessions}{sessions}. Enter
\c {t yoursess} or \c {t sess yoursess} to trigger \uicontrol File >
\uicontrol Sessions > \e yoursessionname.
\uicontrol Sessions > \e <session_name>.
\section2 Default Filters

View File

@@ -0,0 +1,96 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\previouspage creator-language-servers.html
\page creator-copilot.html
\nextpage creator-python-development.html
\title Using GitHub Copilot
The experimental Copilot plugin integrates
\l{https://github.com/features/copilot}{GitHub Copilot} into \QC.
You can view suggestions from Copilot in the \uicontrol Edit mode.
\section1 Requirements
To use the Copilot plugin, you need:
\list
\li An active \l{https://docs.github.com/en/billing/managing-billing-for-github-copilot/about-billing-for-github-copilot}
{GitHub Copilot subscription}.
\li GitHub Copilot Neovim plugin installed, as described in
\l{https://docs.github.com/en/copilot/getting-started-with-github-copilot?tool=neovim}
{About GitHub Copilot and Neovim}.
\endlist
\section1 Enabling the Copilot Plugin
To enable the Copilot plugin:
\list 1
\li Select \uicontrol Help > \uicontrol {About Plugins} >
\uicontrol Utilities > \uicontrol Copilot to enable the plugin.
\li Select \uicontrol {Restart Now} to restart \QC and load the plugin.
\endlist
\section1 Setting Copilot Preferences
To set preferences for using Copilot:
\list 1
\li Select \uicontrol Edit > \uicontrol Preferences >
\uicontrol Copilot.
\image qtcreator-preferences-copilot.webp {Copilot tab in Preferences}
\li Select \uicontrol {Sign In} to sign into your subscription, activate
your device, and authorize the GitHub Copilot plugin.
The button turns into a \uicontrol {Sign Out} button.
\li Select the \uicontrol {Enable Copilot} check box to use Copilot.
\li In the \uicontrol {Node.js path} field, enter the full path to the
Node.js executable.
\li In the \uicontrol {Path to agent.js} field, enter the path to
agent.js in the Copilot Neovim plugin.
\li Select the \uicontrol {Request completions automatically} checkbox to
receive suggestions for the current text cursor position when you
make changes.
\endlist
\section1 Pair-Programming with Copilot
When you write code in the \l {Working in Edit Mode}{Edit} mode and
\uicontrol {Request completions automatically} is enabled, Copilot
automatically makes suggestions when you type.
\image qtcreator-copilot.gif {Receiving suggestions from Copilot in the editor}
To manually request a suggestion at the current editor's cursor position,
select \uicontrol {Request Copilot Suggestion} in the context menu.
Hover the mouse over a suggestion to show a toolbar with
\inlineimage icons/prev.png
and \inlineimage icons/next.png
buttons for cycling between Copilot suggestions.
To apply a suggestion as a whole, select \uicontrol Apply or press
the \key Tab key.
To apply a suggestion word-by-word, select \uicontrol {Apply Word}
or press \key {Alt+Right}.
\section1 Enabling and Disabling Copilot
You can enable and disable the Copilot plugin either globally for all
projects or at project level for a particular project.
To enable or disable Copilot suggestions globally, select the
\inlineimage icons/copilot.png
(\uicontrol {Toggle Copilot}) button. This also sets the value of the
\uicontrol {Enable Copilot} check box in \uicontrol Edit >
\uicontrol Preferences accordingly.
To enable or disable Copilot suggestions for a particular project,
select \uicontrol Projects > \uicontrol {Project Settings} >
\uicontrol Copilot, and then select or deselect the
\uicontrol {Enable Copilot} check box.
*/

View File

@@ -1,10 +1,10 @@
// Copyright (C) 2022 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-markdown-editor.html
\page creator-language-servers.html
\nextpage creator-mime-types.html
\nextpage creator-copilot.html
\title Using Language Servers

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// **********************************************************************
@@ -8,7 +8,7 @@
// **********************************************************************
/*!
\previouspage creator-language-servers.html
\previouspage creator-python-development.html
\page creator-mime-types.html
\nextpage creator-modeling.html

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// **********************************************************************
@@ -58,7 +58,7 @@
in context menus} check box indicates whether the platform default value
is \c on or \c off.
\image qtcreator-options-environment-interface.png "Interface tab in the Environment preferences"
\image qtcreator-preferences-environment-interface.webp {Interface tab in Environment preferences}
\section1 Configuring Keyboard Shortcuts
@@ -234,7 +234,7 @@
\li Alt+O
\row
\li Maximize output views
\li Alt+9
\li Alt+Shift+9
\row
\li Move to next item in output
\li F6
@@ -433,6 +433,8 @@
\row
\li Find references to symbol under cursor
\li Ctrl+Shift+U
\note If this keyboard shortcut does not work on Linux, see
\l {Editing Issues}.
\row
\li Follow symbol under cursor

View File

@@ -96,7 +96,7 @@
a build, detailed output from the compiler, status of a program when it is
executed, debug output, or search results.
\image qtcreator-output-panes-taskbar.png "Output on the taskbar"
\image qtcreator-output-panes-taskbar.webp "Output on the taskbar"
To view different types of output, use the following shortcuts:

View File

@@ -239,7 +239,9 @@
For console applications that require input, select \uicontrol Projects >
\uicontrol {Run Settings} > \uicontrol {Run in terminal}. To specify the
terminal to use, select \uicontrol Edit > \uicontrol Preferences >
\uicontrol Environment > \uicontrol System.
\uicontrol Environment > \uicontrol System. To use an \l{Terminal}
{internal terminal}, select \uicontrol Edit > \uicontrol Preferences
> \uicontrol Terminal > \uicontrol {Use internal terminal}.
\b {On Windows:} Output is displayed differently for \e{console
applications} and \e{GUI applications}.

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2019 The Qt Company Ltd.
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// **********************************************************************
@@ -68,6 +68,23 @@
\li Code completion does not support typedefs for nested classes.
\li When developing on Linux, the \key {Ctrl+Shift+U} keyboard shortcut
might not work because it conflicts with a shortcut of the
Intelligent Input Bus (ibus). You can change the shortcut for finding
references to the symbol under the cursor either in \QC or in ibus.
To set another \l {Keyboard Shortcuts}{keyboard shortcut}
in \QC, select \uicontrol Edit > \uicontrol Preferences >
\uicontrol Environment > \uicontrol Keyboard.
To change the shortcut in ibus, enter the following command on the
command line to start ibus setup:
\badcode
ibus-setup
\endcode
Then, change the unicode code point shortcut in the \uicontrol Emoji
tab to something else than \key {<Control><Shift>u}.
\endlist
\section1 Projects Issues

View File

@@ -21,7 +21,10 @@
For console applications, check the \uicontrol{Run in terminal} check box.
To specify the terminal to use on Linux and \macos, select \uicontrol Edit
> \uicontrol Preferences > \uicontrol Environment > \uicontrol System.
> \uicontrol Preferences > \uicontrol Environment > \uicontrol System. To use
an \l{Terminal}{internal terminal}, select \uicontrol Edit >
\uicontrol Preferences > \uicontrol Terminal >
\uicontrol {Use internal terminal}.
To run with special environment variables set up, select them in the
\uicontrol {Run Environment} section. For more information, see

View File

@@ -0,0 +1,96 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page creator-python-development.html
\previouspage creator-copilot.html
\nextpage creator-mime-types.html
\title Developing Qt for Python Applications
\l {https://doc.qt.io/qtforpython/index.html}{Qt for Python} enables you
to use Qt 6 API in Python applications. You can use the PySide6 modules
to gain access to individual Qt modules, such as \l {Qt Core}, \l {Qt GUI},
and \l {Qt Widgets}.
The following sections describe using \QC for developing with Qt for Python:
\list
\li \l{Creating Widget-Based Qt for Python Applications}
{Creating Qt for Python Applications}
\li \l{Setting Up PySide6}
\li \l{Selecting the Python Interpreter}
\li \l{Creating a Virtual Environment}
\li \l{Using Python Interactive Shell}
\li \l{Python Language Server}
\li \l{Running Python Projects}
\li \l{Specifying Run Settings for Python Projects}
\li \l{PDB}
\li \l{Launching the Debugger}
\endlist
For more information about developing with Qt for Python, including
limitations, see \l {https://doc.qt.io/qtforpython/index.html}
{Qt for Python}.
\section1 Setting Up PySide6
If you have not installed the required version of PySide6, \QC prompts you to
do so when you open a .py file.
\image qtcreator-python-install.webp {Prompts to install PySide6 and Python language server}
Further, \QC prompts you to install the \l {Python Language Server}
{Python language server} that offers services such as code completion
and annotations. Select \uicontrol Install to install PySide6 and the
language server.
\section1 Selecting the Python Interpreter
You select the initial Python interpreter when you use the Qt for Python
Application wizard templates to create Python projects.
\image qtcreator-python-wizard-define-python-interpreter.webp {Define Python Interpreter wizard page}
You can see the current Python interpreter on the \uicontrol Edit mode
toolbar.
\image qtcreator-python-interpreter-edit-mode.webp {Python interpreter on the Edit mode toolbar}
You can change the interpreter to use for a particular project in
\uicontrol Projects > \uicontrol Run > \uicontrol Interpreter.
\image qtcreator-python-run-settings.png {Python run settings}
To see the available interpreters and choose another interpreter, select the
current interpreter, and then select \uicontrol {Manage Python Interpreters}.
Or, select \uicontrol Edit > \uicontrol Preferences > \uicontrol Python >
\uicontrol Interpreters.
\image qtcreator-python-interpreters.png {Python Interpreters in Preferences}
You can add and remove interpreters and clean up references to interpreters
that you uninstalled, but that still appear in the list. In addition, you
can set the interpreter to use by default.
\section1 Creating a Virtual Environment
To create a virtual environment (\c venv) when you use the Qt for
Python Application wizard templates to create Python projects, select
the \uicontrol {Create new virtual environment} check box on the
\uicontrol {Define Python Interpreter} wizard page. Specify the
directory where to create the environment in
\uicontrol {Path to virtual environment}.
\section1 Using Python Interactive Shell
You can write Python code in the Edit mode. Select \uicontrol REPL on the
toolbar to start the \l{https://pythonprogramminglanguage.com/repl/}
{Python interactive shell} in the \l Terminal pane.
\image qtcreator-terminal-python.webp {Python shell on the taskbar}
To start the shell and import the current file as a module, select
\uicontrol {REPL Import File}. To also import all functions from
the file, select \uicontrol {REPL Import *}.
*/

View File

@@ -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
/*!
@@ -6,38 +6,12 @@
\section2 Creating Widget-Based Qt for Python Applications
\l {https://doc.qt.io/qtforpython/index.html}{Qt for Python} enables you
to use Qt 6 API in Python applications. You can use the PySide6 modules
to gain access to individual Qt modules, such as \l {Qt Core}, \l {Qt GUI},
and \l {Qt Widgets}.
If you have not installed PySide6, \QC prompts you to install it after
you create the project. Further, it prompts you to install the
\l {Python Language Server}{Python language server} that offers services
such as code completion and annotations. Select \uicontrol Install to install
PySide6 and the language server.
You can see the current Python interpreter on the \uicontrol Edit mode
toolbar.
\image qtcreator-python-interpreter-edit-mode.webp {Python interpreter on the Edit mode toolbar}
To see the available interpreters and change their paths, select
the interpreter, and then select \uicontrol {Manage Python Interpreters}.
Or, select \uicontrol Edit > \uicontrol Preferences > \uicontrol Python >
\uicontrol Interpreters.
\image qtcreator-python-interpreters.png {Python Interpreters in Preferences}
You can add and remove interpreters and clean up references to interpreters
that you uninstalled, but that still appear in the list. In addition, you
can set the interpreter to use by default.
The Qt for Python Application wizards generate a \c {.pyproject} file that
lists the files in the Python project and a \c {.py} file that has
some boilerplate code. In addition, the widget-based UI wizard creates a
\c {.ui} file that has a \QD form, and the Qt Quick Application wizard
creates a \c {.qml} file that has Qt Quick controls.
lists the files in the \l{Developing Qt for Python Applications}{Python}
project and a \c {.py} file that has some boilerplate code. In addition, the
widget-based UI wizard creates a \c {.ui} file that has a \QD form, and the
Qt Quick Application wizard creates a \c {.qml} file that imports Qt Quick
controls.
The \c{.pyproject} files are JSON-based configuration files that replace
the previously used \c {.pyqtc} configuration files. You can still open and
@@ -49,7 +23,7 @@
the PySide version, class name, base class, and source file for the
class.
\image qtcreator-python-wizard-app-window.png {Qt for Python wizard for creating a widget-based UI}
\image qtcreator-python-wizard-app-window.png {Define Class wizard page}
The wizard adds the imports to the source file for
access to the QApplication, the base class you selected in the Qt
@@ -121,13 +95,8 @@
\endcode
You can now modify the boilerplate code in the Edit mode to develop your
Python application. Select \uicontrol REPL on the toolbar to start the
\l{https://pythonprogramminglanguage.com/repl/}{Python interactive shell}.
To start the shell and import the current file as a module, select
\uicontrol {REPL Import File}. To also import all functions from
the file, select \uicontrol {REPL Import *}.
Always regenerate the Python code after modifying a UI file.
Python application. Always regenerate the Python code after modifying a
UI file.
Open the .ui file in the \uicontrol Design mode to create a widget-based UI
in \QD.

View File

@@ -23,7 +23,7 @@
You can specify settings for running Qt for Python applications:
\image qtcreator-python-run-settings.png
\image qtcreator-python-run-settings.png {Python run settings}
\list
\li In the \uicontrol Interpreter field, specify the path to the

View File

@@ -130,6 +130,8 @@
\endlist
\li \l{Editing Markdown Files}
\li \l{Using Language Servers}
\li \l{Using GitHub Copilot}
\li \l{Developing Qt for Python Applications}
\li \l{Editing MIME Types}
\li \l{Modeling}
\li \l{Editing State Charts}

View File

@@ -60,7 +60,9 @@
\li Open a terminal window in the selected directory or in the directory
that has the file. To specify the terminal to use on Linux and
\macos, select \uicontrol Edit > \uicontrol Preferences >
\uicontrol Environment > \uicontrol System.
\uicontrol Environment > \uicontrol System. To use an \l{Terminal}
{internal terminal}, select \uicontrol Edit > \uicontrol Preferences
> \uicontrol Terminal > \uicontrol {Use internal terminal}.
\li Search from the selected directory.
\li View file properties, such as name, path, MIME type, default editor,
line endings, indentation, owner, size, last read and modified

View File

@@ -84,6 +84,9 @@
\li Open a terminal window in the project directory. To specify the
terminal to use on Linux and \macos, select \uicontrol Edit >
\uicontrol Preferences > \uicontrol Environment > \uicontrol System.
To use an \l{Terminal}{internal terminal}, select \uicontrol Edit >
\uicontrol Preferences > \uicontrol Terminal >
\uicontrol {Use internal terminal}.
\li Open a terminal window in the project directory that you configured
for building or running the project.
\li Expand or collapse the tree view to show or hide all files and

View File

@@ -143,7 +143,7 @@
> \uicontrol Environment, and then select a theme in the \uicontrol Theme
field.
\image qtcreator-options-environment-interface.png "Interface preferences"
\image qtcreator-preferences-environment-interface.webp {Interface preferences}
\section1 Changing Languages
@@ -376,13 +376,17 @@
\list
\li \uicontrol{Issues}
\li \l {Issues}
\li \uicontrol{Search Results}
\li \l {Search Results}
\li \uicontrol{Application Output}
\li \l {Application Output}
\li \uicontrol{Compile Output}
\li \l {Compile Output}
\if defined(qtcreator)
\li \l {Terminal}
\endif
\li \uicontrol {QML Debugger Console}
@@ -396,7 +400,7 @@
\li \l{Using Squish}{Squish} test results and Squish Server and
Runner logs
\li \uicontrol {To-Do Entries}
\li \l {To-Do Entries}
\endif
@@ -404,7 +408,7 @@
Output is available on the taskbar in all \l{Selecting Modes}{modes}.
\image qtcreator-output-panes-taskbar.png "Output on the taskbar"
\image qtcreator-output-panes-taskbar.webp "Output on the taskbar"
You can view output in the following ways:
@@ -415,7 +419,8 @@
\li Select \inlineimage icons/output-pane-menu.png
, and then select the view to open.
\li Select \uicontrol View > \uicontrol Output.
The menu items also display the keyboard shortcuts that you can use.
The menu items also display the \l{Keyboard Shortcuts}
{keyboard shortcuts} that you can use.
\endlist
To maximize an open output view, select the \inlineimage icons/arrowup.png
@@ -447,7 +452,7 @@
\uicontrol Preferences > \uicontrol Environment > \uicontrol Interface, and
then select the codec in the \uicontrol {Text codec for tools} field.
\image qtcreator-options-environment-interface.png "Interface tab in the Environment preferences"
\image qtcreator-preferences-environment-interface.webp {Interface tab in Environment preferences}
\section1 Finding and Filtering Output
@@ -644,6 +649,101 @@
\endlist
\if defined(qtcreator)
\section1 Terminal
When you select the \uicontrol {Run in Terminal} check box and run an
application or the \uicontrol {Open Terminal} button to open a terminal,
the default terminal opens. On Linux and \macos, you can set the default
terminal by selecting \uicontrol Edit > \uicontrol Preferences >
\uicontrol Environment > \uicontrol System.
To open the terminal on the taskbar instead of in a separate window, select
\uicontrol Edit > \uicontrol Preferences > \uicontrol Terminal >
\uicontrol {Use internal terminal}.
\image qtcreator-output-terminal.webp {Terminal pane}
To clear the terminal, select \inlineimage icons/clean_pane_small.png
(\uicontrol Clear).
To close the current terminal, select \inlineimage icons/terminal-close.png
.
To open new terminals as tabs, select \inlineimage icons/terminal-create.png
.
To move between terminals, select the tabs or \inlineimage icons/arrowup.png
and \inlineimage icons/arrowdown.png
.
To select a word in a terminal, double-click it. To select the whole line,
triple-click it.
To open links in a browser, files in the editor, or folders in the
\l Projects view, hover the mouse over them, and press \key Ctrl.
To \l{Finding and Replacing}{search} through the output, press \key {Ctrl+F}.
To make the font larger or smaller, select the \inlineimage icons/plus.png
and \inlineimage icons/minus.png
buttons. You can also change the font size in terminal preferences.
To open terminal preferences, select \inlineimage icons/settings.png
(\uicontrol Configure).
Most of the \QC keyboard shortcuts are disabled in the terminal, except the
ones for opening terminal preferences or the locator and quitting \QC. To
send the escape key to the terminal instead of closing the terminal, select
\uicontrol {Shift+Esc}. You can also specify that the escape key is sent to
the terminal in terminal preferences.
\section2 Setting Terminal Preferences
To set preferences for the internal terminal, select \uicontrol Edit >
\uicontrol Preferences > \uicontrol Terminal, or select the
\uicontrol Configure button in the \uicontrol Terminal pane.
\image qtcreator-preferences-terminal.webp {Terminal tab in Preferences}
\table
\header
\li Option
\li Value
\row
\li \uicontrol {Use internal terminal}
\li Open the \uicontrol Terminal pane when you select
\uicontrol {Run in Terminal} or \uicontrol {Open Terminal}.
\row
\li \uicontrol {Send escape key to terminal}
\li Send the escape key to the terminal instead of closing the terminal.
\row
\li \uicontrol {Audible bell}
\li Play an audible bell when the a bell character is received.
\row
\li \uicontrol {Allow blinking cursor}
\li Allow the cursor to blink.
\row
\li \uicontrol {Font}
\li Select the \uicontrol {Font family} and \uicontrol Size for the text
in the terminal. You can also use the \inlineimage icons/plus.png
and \inlineimage icons/minus.png buttons in the \uicontrol Terminal
pane to change the font size.
\row
\li \uicontrol {Colors}
\li Set colors for the \uicontrol Terminal pane \uicontrol Foreground,
\uicontrol Background, \uicontrol Selection, and
\uicontrol {Find match}.
\row
\li \uicontrol {Default shell}
\li Set the full path to the default terminal executable in
\uicontrol {Shell path} and the arguments to pass to the shell
in \uicontrol {Shell arguments}.
\endtable
To use an existing color scheme, select \uicontrol {Load Theme}. To revert
color changes, select \uicontrol {Reset Theme}.
\section1 To-Do Entries
\uicontrol {To-Do Entries} lists the BUG, FIXME, NOTE, TODO, and

View File

@@ -51,6 +51,7 @@ excludedirs += ../../qtcreator/examples/accelbubble \
../../qtcreator/src/meson \
../../qtcreator/src/overview/creator-only \
../../qtcreator/src/projects \
../../qtcreator/src/python \
../../qtcreator/src/qnx \
../../qtcreator/src/qtquick/creator-only \
../../qtcreator/src/vcs/creator-only \

View File

@@ -161,6 +161,11 @@
"target": "%{ProjectDirectory}/qmlcomponents",
"condition": "%{QdsProjectStyle}"
},
{
"source": "%{QdsWizardPath}/common/insight.tpl",
"target": "%{ProjectDirectory}/insight",
"condition": "%{QdsProjectStyle}"
},
{
"source": "%{QdsWizardPath}/common/main.qml",
"target": "%{ProjectDirectory}/main.qml",

View File

@@ -586,7 +586,7 @@ int main(int argc, char **argv)
QCoreApplication::setOrganizationName(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR));
QGuiApplication::setApplicationDisplayName(Core::Constants::IDE_DISPLAY_NAME);
auto cleanup = qScopeGuard([] { Utils::Singleton::deleteAll(); });
const QScopeGuard cleanup([] { Utils::Singleton::deleteAll(); });
const QStringList pluginArguments = app.arguments();
@@ -647,7 +647,7 @@ int main(int argc, char **argv)
for (QString locale : std::as_const(uiLanguages)) {
locale = QLocale(locale).name();
if (translator.load("qtcreator_" + locale, creatorTrPath)) {
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &qtTrPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
const QString &qtTrFile = QLatin1String("qt_") + locale;
// Binary installer puts Qt tr files into creatorTrPath
if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, creatorTrPath)) {

View File

@@ -25,7 +25,7 @@
#include "cppassert.h"
#include <utils/executeondestruction.h>
#include <QScopeGuard>
#include <cctype>
@@ -756,9 +756,9 @@ void Lexer::scanStringLiteral(Token *tok, unsigned char hint)
void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint)
{
Utils::ExecuteOnDestruction suffixCleaner;
if (!control())
suffixCleaner.reset([this] { _expectedRawStringSuffix.clear(); });
QScopeGuard cleanup([this] { _expectedRawStringSuffix.clear(); });
if (control())
cleanup.dismiss();
const char *yytext = _currentChar;
@@ -827,7 +827,7 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint)
tok->f.kind = T_RAW_STRING_LITERAL;
if (!control() && !closed) {
suffixCleaner.reset([]{});
cleanup.dismiss();
s._tokenKind = tok->f.kind;
_expectedRawStringSuffix.prepend(')');
_expectedRawStringSuffix.append('"');

View File

@@ -187,7 +187,7 @@ namespace ADS
void DockWidgetTabPrivate::moveTab(QMouseEvent *event)
{
event->accept();
QPoint distance = event->globalPos() - m_globalDragStartMousePosition;
QPoint distance = event->globalPosition().toPoint() - m_globalDragStartMousePosition;
distance.setY(0);
auto targetPos = distance + m_tabDragStartPosition;
targetPos.rx() = qMax(targetPos.x(), 0);
@@ -294,7 +294,7 @@ namespace ADS
{
if (event->button() == Qt::LeftButton) {
event->accept();
d->saveDragStartMousePosition(event->globalPos());
d->saveDragStartMousePosition(event->globalPosition().toPoint());
d->m_dragState = DraggingMousePressed;
emit clicked();
return;
@@ -314,7 +314,7 @@ namespace ADS
case DraggingTab:
// End of tab moving, emit signal
if (d->m_dockArea) {
emit moved(event->globalPos());
emit moved(event->globalPosition().toPoint());
}
break;
@@ -354,7 +354,7 @@ namespace ADS
auto mappedPos = mapToParent(event->pos());
bool mouseOutsideBar = (mappedPos.x() < 0) || (mappedPos.x() > parentWidget()->rect().right());
// Maybe a fixed drag distance is better here ?
int dragDistanceY = qAbs(d->m_globalDragStartMousePosition.y() - event->globalPos().y());
int dragDistanceY = qAbs(d->m_globalDragStartMousePosition.y() - event->globalPosition().toPoint().y());
if (dragDistanceY >= DockManager::startDragDistance() || mouseOutsideBar) {
// If this is the last dock area in a dock container with only
// one single dock widget it does not make sense to move it to a new
@@ -382,7 +382,7 @@ namespace ADS
}
return;
} else if (d->m_dockArea->openDockWidgetsCount() > 1
&& (event->globalPos() - d->m_globalDragStartMousePosition).manhattanLength()
&& (event->globalPosition().toPoint() - d->m_globalDragStartMousePosition).manhattanLength()
>= QApplication::startDragDistance()) // Wait a few pixels before start moving
{
// If we start dragging the tab, we save its initial position to
@@ -502,7 +502,7 @@ namespace ADS
// sense to move it to a new floating widget and leave this one empty
if ((!d->m_dockArea->dockContainer()->isFloating() || d->m_dockArea->dockWidgetsCount() > 1)
&& d->m_dockWidget->features().testFlag(DockWidget::DockWidgetFloatable)) {
d->saveDragStartMousePosition(event->globalPos());
d->saveDragStartMousePosition(event->globalPosition().toPoint());
d->startFloating(DraggingInactive);
}

View File

@@ -30,7 +30,6 @@
#include <cplusplus/Literals.h>
#include <cplusplus/cppassert.h>
#include <utils/executeondestruction.h>
#include <utils/filepath.h>
#include <utils/scopedswap.h>
@@ -40,6 +39,7 @@
#include <QLoggingCategory>
#include <QTime>
#include <QPair>
#include <QScopeGuard>
#include <cctype>
#include <deque>
@@ -1513,14 +1513,15 @@ bool Preprocessor::collectActualArguments(PPToken *tk, QVector<QVector<PPToken>
Q_ASSERT(tk);
Q_ASSERT(actuals);
ExecuteOnDestruction removeBlockedName;
if (m_state.m_tokenBuffer) {
removeBlockedName.reset([this] {
QScopeGuard cleanup([this] {
if (m_state.m_tokenBuffer && !m_state.m_tokenBuffer->blockedMacroNames.empty())
m_state.m_tokenBuffer->blockedMacroNames.pop_back();
});
if (m_state.m_tokenBuffer)
m_state.m_tokenBuffer->blockedMacroNames.push_back(parentMacroName);
}
else
cleanup.dismiss();
lex(tk); // consume the identifier

View File

@@ -10,6 +10,17 @@
#include "pluginspec.h"
#include "pluginspec_p.h"
#include <utils/algorithm.h>
#include <utils/benchmarker.h>
#include <utils/fileutils.h>
#include <utils/futuresynchronizer.h>
#include <utils/hostosinfo.h>
#include <utils/mimeutils.h>
#include <utils/process.h>
#include <utils/qtcassert.h>
#include <utils/qtcsettings.h>
#include <utils/threadutils.h>
#include <QCoreApplication>
#include <QCryptographicHash>
#include <QDateTime>
@@ -23,23 +34,12 @@
#include <QMessageBox>
#include <QMetaProperty>
#include <QPushButton>
#include <QScopeGuard>
#include <QSysInfo>
#include <QTextStream>
#include <QTimer>
#include <QWriteLocker>
#include <utils/algorithm.h>
#include <utils/benchmarker.h>
#include <utils/executeondestruction.h>
#include <utils/fileutils.h>
#include <utils/futuresynchronizer.h>
#include <utils/hostosinfo.h>
#include <utils/mimeutils.h>
#include <utils/process.h>
#include <utils/qtcassert.h>
#include <utils/qtcsettings.h>
#include <utils/threadutils.h>
#ifdef WITH_TESTS
#include <utils/hostosinfo.h>
#include <QTest>
@@ -399,7 +399,7 @@ static QString filled(const QString &s, int min)
QString PluginManager::systemInformation()
{
QString result;
CommandLine qtDiag(FilePath::fromString(QLibraryInfo::location(QLibraryInfo::BinariesPath))
CommandLine qtDiag(FilePath::fromString(QLibraryInfo::path(QLibraryInfo::BinariesPath))
.pathAppended("qtdiag").withExecutableSuffix());
Process qtDiagProc;
qtDiagProc.setCommand(qtDiag);
@@ -1268,8 +1268,7 @@ void PluginManagerPrivate::startTests()
continue; // plugin not loaded
const QVector<QObject *> testObjects = plugin->createTestObjects();
ExecuteOnDestruction deleteTestObjects([&]() { qDeleteAll(testObjects); });
Q_UNUSED(deleteTestObjects)
const QScopeGuard cleanup([&] { qDeleteAll(testObjects); });
const bool hasDuplicateTestObjects = testObjects.size()
!= Utils::filteredUnique(testObjects).size();

View File

@@ -44,7 +44,7 @@ DragWidget::DragWidget(QWidget *parent) : QFrame(parent)
void DragWidget::mousePressEvent(QMouseEvent * event)
{
if (event->button() == Qt::LeftButton) {
m_startPos = event->globalPos() - parentWidget()->mapToGlobal((pos()));
m_startPos = event->globalPosition().toPoint() - parentWidget()->mapToGlobal((pos()));
m_opacityEffect = new QGraphicsOpacityEffect;
setGraphicsEffect(m_opacityEffect);
event->accept();
@@ -77,7 +77,7 @@ void DragWidget::mouseMoveEvent(QMouseEvent * event)
{
if (event->buttons() & Qt::LeftButton) {
if (m_startPos != QPoint(-1, -1)) {
QPoint newPos = parentWidget()->mapFromGlobal(event->globalPos() - m_startPos);
QPoint newPos = parentWidget()->mapFromGlobal(event->globalPosition().toPoint() - m_startPos);
newPos.setX(limit(newPos.x(), 20, parentWidget()->width() - 20 - width()));
newPos.setY(limit(newPos.y(), 2, parentWidget()->height() - 20 - height()));

View File

@@ -649,6 +649,7 @@ QList<StaticAnalysis::Type> Check::defaultDisabledMessages()
HintBinaryOperatorSpacing,
HintOneStatementPerLine,
HintExtraParentheses,
WarnAliasReferRootHierarchy,
// QmlDesigner related
WarnImperativeCodeNotEditableInVisualDesigner,
@@ -748,6 +749,7 @@ void Check::enableQmlDesignerChecks()
enableMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner);
enableMessage(ErrUnsupportedRootTypeInVisualDesigner);
enableMessage(ErrInvalidIdeInVisualDesigner);
enableMessage(WarnAliasReferRootHierarchy);
//## triggers too often ## check.enableMessage(StaticAnalysis::WarnUndefinedValueForVisualDesigner);
}

View File

@@ -114,9 +114,9 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
qRegisterMetaType<QmlJS::PathsAndLanguages>("QmlJS::PathsAndLanguages");
m_defaultProjectInfo.qtQmlPath =
FilePath::fromUserInput(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath));
FilePath::fromUserInput(QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath));
m_defaultProjectInfo.qmllsPath = ModelManagerInterface::qmllsForBinPath(
FilePath::fromUserInput(QLibraryInfo::location(QLibraryInfo::BinariesPath)),
FilePath::fromUserInput(QLibraryInfo::path(QLibraryInfo::BinariesPath)),
QLibraryInfo::version());
m_defaultProjectInfo.qtVersionString = QLibraryInfo::version().toString();

View File

@@ -5,7 +5,9 @@ add_qtc_library(Tasking OBJECT
SOURCES
barrier.cpp barrier.h
concurrentcall.h
networkquery.cpp networkquery.h
networkquery.cpp
tasking_global.h
tasktree.cpp tasktree.h
EXPLICIT_MOC
networkquery.h
)

View File

@@ -1750,9 +1750,9 @@ TaskTree::TaskTree()
{
}
TaskTree::TaskTree(const Group &root) : TaskTree()
TaskTree::TaskTree(const Group &recipe) : TaskTree()
{
setupRoot(root);
setRecipe(recipe);
}
TaskTree::~TaskTree()
@@ -1763,27 +1763,27 @@ TaskTree::~TaskTree()
delete d;
}
void TaskTree::setupRoot(const Group &root)
void TaskTree::setRecipe(const Group &recipe)
{
QTC_ASSERT(!isRunning(), qWarning("The TaskTree is already running, ignoring..."); return);
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The setupRoot() is called from one of the"
"TaskTree handlers, ingoring..."); return);
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The setRecipe() is called from one of the"
"TaskTree handlers, ignoring..."); return);
d->m_storages.clear();
d->m_root.reset(new TaskNode(d, root, nullptr));
d->m_root.reset(new TaskNode(d, recipe, nullptr));
}
void TaskTree::start()
{
QTC_ASSERT(!isRunning(), qWarning("The TaskTree is already running, ignoring..."); return);
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The start() is called from one of the"
"TaskTree handlers, ingoring..."); return);
"TaskTree handlers, ignoring..."); return);
d->start();
}
void TaskTree::stop()
{
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The stop() is called from one of the"
"TaskTree handlers, ingoring..."); return);
"TaskTree handlers, ignoring..."); return);
d->stop();
}

View File

@@ -378,10 +378,10 @@ class TASKING_EXPORT TaskTree final : public QObject
public:
TaskTree();
TaskTree(const Group &root);
TaskTree(const Group &recipe);
~TaskTree();
void setupRoot(const Group &root);
void setRecipe(const Group &recipe);
void start();
void stop();

View File

@@ -43,7 +43,6 @@ add_qtc_library(Utils
environmentfwd.h
environmentmodel.cpp environmentmodel.h
execmenu.cpp execmenu.h
executeondestruction.h
expected.h
externalterminalprocessimpl.cpp externalterminalprocessimpl.h
fadingindicator.cpp fadingindicator.h

View File

@@ -2347,7 +2347,7 @@ void IntegersAspect::setDefaultValue(const QList<int> &value)
*/
TextDisplay::TextDisplay(AspectContainer *container)
: BaseAspect(container)
: BaseAspect(container), d(new Internal::TextDisplayPrivate)
{}
/*!

View File

@@ -587,7 +587,7 @@ ItemViewEvent::ItemViewEvent(QEvent *ev, QAbstractItemView *view)
case QEvent::DragEnter:
case QEvent::DragMove:
case QEvent::Drop:
m_pos = static_cast<QDropEvent *>(ev)->pos();
m_pos = static_cast<QDropEvent *>(ev)->position().toPoint();
m_index = view->indexAt(m_pos);
break;
default:

View File

@@ -31,7 +31,7 @@ FilePath BuildableHelperLibrary::qtChooserToQmakePath(const FilePath &qtChooser)
int pos = output.indexOf(toolDir);
if (pos == -1)
return {};
pos += toolDir.count();
pos += toolDir.size();
int end = output.indexOf('\"', pos);
if (end == -1)
return {};

View File

@@ -8,7 +8,6 @@
#include "qtcassert.h"
#include <QLoggingCategory>
#include <QScopeGuard>
Q_LOGGING_CATEGORY(deviceShellLog, "qtc.utils.deviceshell", QtWarningMsg)

View File

@@ -24,8 +24,8 @@ namespace Utils {
static int commonPrefix(const QString &text1, const QString &text2)
{
int i = 0;
const int text1Count = text1.count();
const int text2Count = text2.count();
const int text1Count = text1.size();
const int text2Count = text2.size();
const int maxCount = qMin(text1Count, text2Count);
while (i < maxCount) {
if (text1.at(i) != text2.at(i))
@@ -38,8 +38,8 @@ static int commonPrefix(const QString &text1, const QString &text2)
static int commonSuffix(const QString &text1, const QString &text2)
{
int i = 0;
const int text1Count = text1.count();
const int text2Count = text2.count();
const int text1Count = text1.size();
const int text2Count = text2.size();
const int maxCount = qMin(text1Count, text2Count);
while (i < maxCount) {
if (text1.at(text1Count - i - 1) != text2.at(text2Count - i - 1))
@@ -52,8 +52,8 @@ static int commonSuffix(const QString &text1, const QString &text2)
static int commonOverlap(const QString &text1, const QString &text2)
{
int i = 0;
const int text1Count = text1.count();
const int text2Count = text2.count();
const int text1Count = text1.size();
const int text2Count = text2.size();
const int maxCount = qMin(text1Count, text2Count);
while (i < maxCount) {
if (QStringView(text1).mid(text1Count - maxCount + i) == QStringView(text2).left(maxCount - i))
@@ -66,7 +66,7 @@ static int commonOverlap(const QString &text1, const QString &text2)
static QList<Diff> decode(const QList<Diff> &diffList, const QStringList &lines)
{
QList<Diff> newDiffList;
newDiffList.reserve(diffList.count());
newDiffList.reserve(diffList.size());
for (const Diff &diff : diffList) {
QString text;
for (QChar c : diff.text) {
@@ -80,7 +80,7 @@ static QList<Diff> decode(const QList<Diff> &diffList, const QStringList &lines)
static QList<Diff> squashEqualities(const QList<Diff> &diffList)
{
if (diffList.count() < 3) // we need at least 3 items
if (diffList.size() < 3) // we need at least 3 items
return diffList;
QList<Diff> newDiffList;
@@ -88,20 +88,20 @@ static QList<Diff> squashEqualities(const QList<Diff> &diffList)
Diff thisDiff = diffList.at(1);
Diff nextDiff = diffList.at(2);
int i = 2;
while (i < diffList.count()) {
while (i < diffList.size()) {
if (prevDiff.command == Diff::Equal
&& nextDiff.command == Diff::Equal) {
if (thisDiff.text.endsWith(prevDiff.text)) {
thisDiff.text = prevDiff.text
+ thisDiff.text.left(thisDiff.text.count()
- prevDiff.text.count());
+ thisDiff.text.left(thisDiff.text.size()
- prevDiff.text.size());
nextDiff.text = prevDiff.text + nextDiff.text;
} else if (thisDiff.text.startsWith(nextDiff.text)) {
prevDiff.text += nextDiff.text;
thisDiff.text = thisDiff.text.mid(nextDiff.text.count())
thisDiff.text = thisDiff.text.mid(nextDiff.text.size())
+ nextDiff.text;
i++;
if (i < diffList.count())
if (i < diffList.size())
nextDiff = diffList.at(i);
newDiffList.append(prevDiff);
} else {
@@ -113,11 +113,11 @@ static QList<Diff> squashEqualities(const QList<Diff> &diffList)
prevDiff = thisDiff;
thisDiff = nextDiff;
i++;
if (i < diffList.count())
if (i < diffList.size())
nextDiff = diffList.at(i);
}
newDiffList.append(prevDiff);
if (i == diffList.count())
if (i == diffList.size())
newDiffList.append(thisDiff);
return newDiffList;
}
@@ -132,9 +132,9 @@ static QList<Diff> cleanupOverlaps(const QList<Diff> &diffList)
// DEL(XXXXABC), INS(DEFXXXX) -> INS(DEF), EQ(XXXX), DEL(ABC)
QList<Diff> newDiffList;
int i = 0;
while (i < diffList.count()) {
while (i < diffList.size()) {
Diff thisDiff = diffList.at(i);
Diff nextDiff = i < diffList.count() - 1
Diff nextDiff = i < diffList.size() - 1
? diffList.at(i + 1)
: Diff(Diff::Equal);
if (thisDiff.command == Diff::Delete
@@ -142,9 +142,9 @@ static QList<Diff> cleanupOverlaps(const QList<Diff> &diffList)
const int delInsOverlap = commonOverlap(thisDiff.text, nextDiff.text);
const int insDelOverlap = commonOverlap(nextDiff.text, thisDiff.text);
if (delInsOverlap >= insDelOverlap) {
if (delInsOverlap > thisDiff.text.count() / 2
|| delInsOverlap > nextDiff.text.count() / 2) {
thisDiff.text = thisDiff.text.left(thisDiff.text.count() - delInsOverlap);
if (delInsOverlap > thisDiff.text.size() / 2
|| delInsOverlap > nextDiff.text.size() / 2) {
thisDiff.text = thisDiff.text.left(thisDiff.text.size() - delInsOverlap);
const Diff equality(Diff::Equal, nextDiff.text.left(delInsOverlap));
nextDiff.text = nextDiff.text.mid(delInsOverlap);
newDiffList.append(thisDiff);
@@ -155,9 +155,9 @@ static QList<Diff> cleanupOverlaps(const QList<Diff> &diffList)
newDiffList.append(nextDiff);
}
} else {
if (insDelOverlap > thisDiff.text.count() / 2
|| insDelOverlap > nextDiff.text.count() / 2) {
nextDiff.text = nextDiff.text.left(nextDiff.text.count() - insDelOverlap);
if (insDelOverlap > thisDiff.text.size() / 2
|| insDelOverlap > nextDiff.text.size() / 2) {
nextDiff.text = nextDiff.text.left(nextDiff.text.size() - insDelOverlap);
const Diff equality(Diff::Equal, thisDiff.text.left(insDelOverlap));
thisDiff.text = thisDiff.text.mid(insDelOverlap);
newDiffList.append(nextDiff);
@@ -186,7 +186,7 @@ static int cleanupSemanticsScore(const QString &text1, const QString &text2)
if (text1.isEmpty() || text2.isEmpty()) // Edges
return 6;
const QChar char1 = text1[text1.count() - 1];
const QChar char1 = text1[text1.size() - 1];
const QChar char2 = text2[0];
const bool nonAlphaNumeric1 = !char1.isLetterOrNumber();
const bool nonAlphaNumeric2 = !char2.isLetterOrNumber();
@@ -256,19 +256,19 @@ QList<Diff> Differ::moveWhitespaceIntoEqualities(const QList<Diff> &input)
{
QList<Diff> output = input;
for (int i = 0; i < output.count(); i++) {
for (int i = 0; i < output.size(); i++) {
Diff diff = output[i];
if (diff.command != Diff::Equal) {
if (i > 0) { // check previous equality
Diff &previousDiff = output[i - 1];
const int previousDiffCount = previousDiff.text.count();
const int previousDiffCount = previousDiff.text.size();
if (previousDiff.command == Diff::Equal
&& previousDiffCount
&& isWhitespace(previousDiff.text.at(previousDiffCount - 1))) {
// previous diff ends with whitespace
int j = 0;
while (j < diff.text.count()) {
while (j < diff.text.size()) {
if (!isWhitespace(diff.text.at(j)))
break;
++j;
@@ -280,10 +280,10 @@ QList<Diff> Differ::moveWhitespaceIntoEqualities(const QList<Diff> &input)
}
}
}
if (i < output.count() - 1) { // check next equality
const int diffCount = diff.text.count();
if (i < output.size() - 1) { // check next equality
const int diffCount = diff.text.size();
Diff &nextDiff = output[i + 1];
const int nextDiffCount = nextDiff.text.count();
const int nextDiffCount = nextDiff.text.size();
if (nextDiff.command == Diff::Equal
&& nextDiffCount
&& (isWhitespace(nextDiff.text.at(0)) || isNewLine(nextDiff.text.at(0)))) {
@@ -331,7 +331,7 @@ static QString encodeReducedWhitespace(const QString &input,
int inputIndex = 0;
int outputIndex = 0;
while (inputIndex < input.count()) {
while (inputIndex < input.size()) {
QChar c = input.at(inputIndex);
if (isWhitespace(c)) {
@@ -339,7 +339,7 @@ static QString encodeReducedWhitespace(const QString &input,
codeMap->insert(outputIndex, QString(c));
++inputIndex;
while (inputIndex < input.count()) {
while (inputIndex < input.size()) {
QChar reducedChar = input.at(inputIndex);
if (!isWhitespace(reducedChar))
@@ -372,10 +372,10 @@ static QList<Diff> decodeReducedWhitespace(const QList<Diff> &input,
auto it = codeMap.constBegin();
const auto itEnd = codeMap.constEnd();
for (Diff diff : input) {
const int diffCount = diff.text.count();
const int diffCount = diff.text.size();
while ((it != itEnd) && (it.key() < counter + diffCount)) {
const int reversePosition = diffCount + counter - it.key();
const int updatedDiffCount = diff.text.count();
const int updatedDiffCount = diff.text.size();
diff.text.replace(updatedDiffCount - reversePosition, 1, it.value());
++it;
}
@@ -502,8 +502,8 @@ static QString encodeExpandedWhitespace(const QString &leftEquality,
rightCodeMap->clear();
QString output;
const int leftCount = leftEquality.count();
const int rightCount = rightEquality.count();
const int leftCount = leftEquality.size();
const int rightCount = rightEquality.size();
int leftIndex = 0;
int rightIndex = 0;
while (leftIndex < leftCount && rightIndex < rightCount) {
@@ -534,8 +534,8 @@ static QString encodeExpandedWhitespace(const QString &leftEquality,
}
if (!leftWhitespaces.isEmpty() && !rightWhitespaces.isEmpty()) {
const int replacementPosition = output.count();
const int replacementSize = qMax(leftWhitespaces.count(), rightWhitespaces.count());
const int replacementPosition = output.size();
const int replacementSize = qMax(leftWhitespaces.size(), rightWhitespaces.size());
const QString replacement(replacementSize, ' ');
leftCodeMap->insert(replacementPosition, {replacementSize, leftWhitespaces});
rightCodeMap->insert(replacementPosition, {replacementSize, rightWhitespaces});
@@ -574,14 +574,14 @@ static QList<Diff> decodeExpandedWhitespace(const QList<Diff> &input,
auto it = codeMap.constBegin();
const auto itEnd = codeMap.constEnd();
for (Diff diff : input) {
const int diffCount = diff.text.count();
const int diffCount = diff.text.size();
while ((it != itEnd) && (it.key() < counter + diffCount)) {
const int replacementSize = it.value().first;
const int reversePosition = diffCount + counter - it.key();
if (reversePosition < replacementSize)
return QList<Diff>(); // replacement exceeds one Diff
const QString replacement = it.value().second;
const int updatedDiffCount = diff.text.count();
const int updatedDiffCount = diff.text.size();
diff.text.replace(updatedDiffCount - reversePosition,
replacementSize, replacement);
++it;
@@ -619,8 +619,8 @@ static bool diffWithWhitespaceExpandedInEqualities(const QList<Diff> &leftInput,
leftOutput->clear();
rightOutput->clear();
const int leftCount = leftInput.count();
const int rightCount = rightInput.count();
const int leftCount = leftInput.size();
const int rightCount = rightInput.size();
int l = 0;
int r = 0;
@@ -649,10 +649,10 @@ static bool diffWithWhitespaceExpandedInEqualities(const QList<Diff> &leftInput,
// join code map positions with common maps
for (auto it = leftCodeMap.cbegin(), end = leftCodeMap.cend(); it != end; ++it)
commonLeftCodeMap.insert(leftText.count() + it.key(), it.value());
commonLeftCodeMap.insert(leftText.size() + it.key(), it.value());
for (auto it = rightCodeMap.cbegin(), end = rightCodeMap.cend(); it != end; ++it)
commonRightCodeMap.insert(rightText.count() + it.key(), it.value());
commonRightCodeMap.insert(rightText.size() + it.key(), it.value());
leftText.append(commonEquality);
rightText.append(commonEquality);
@@ -739,8 +739,8 @@ void Differ::ignoreWhitespaceBetweenEqualities(const QList<Diff> &leftInput,
leftOutput->clear();
rightOutput->clear();
const int leftCount = leftInput.count();
const int rightCount = rightInput.count();
const int leftCount = leftInput.size();
const int rightCount = rightInput.size();
int l = 0;
int r = 0;
@@ -836,8 +836,8 @@ void Differ::diffBetweenEqualities(const QList<Diff> &leftInput,
leftOutput->clear();
rightOutput->clear();
const int leftCount = leftInput.count();
const int rightCount = rightInput.count();
const int leftCount = leftInput.size();
const int rightCount = rightInput.size();
int l = 0;
int r = 0;
@@ -1000,8 +1000,8 @@ QList<Diff> Differ::preprocess1AndDiff(const QString &text1, const QString &text
const int suffixCount = commonSuffix(newText1, newText2);
if (suffixCount) {
suffix = newText1.right(suffixCount);
newText1 = newText1.left(newText1.count() - suffixCount);
newText2 = newText2.left(newText2.count() - suffixCount);
newText1 = newText1.left(newText1.size() - suffixCount);
newText2 = newText2.left(newText2.size() - suffixCount);
}
QList<Diff> diffList = preprocess2AndDiff(newText1, newText2);
if (prefixCount)
@@ -1025,28 +1025,27 @@ QList<Diff> Differ::preprocess2AndDiff(const QString &text1, const QString &text
return diffList;
}
if (text1.count() != text2.count())
{
const QString longtext = text1.count() > text2.count() ? text1 : text2;
const QString shorttext = text1.count() > text2.count() ? text2 : text1;
if (text1.size() != text2.size()) {
const QString longtext = text1.size() > text2.size() ? text1 : text2;
const QString shorttext = text1.size() > text2.size() ? text2 : text1;
const int i = longtext.indexOf(shorttext);
if (i != -1) {
const Diff::Command command = (text1.count() > text2.count())
const Diff::Command command = (text1.size() > text2.size())
? Diff::Delete : Diff::Insert;
diffList.append(Diff(command, longtext.left(i)));
diffList.append(Diff(Diff::Equal, shorttext));
diffList.append(Diff(command, longtext.mid(i + shorttext.count())));
diffList.append(Diff(command, longtext.mid(i + shorttext.size())));
return diffList;
}
if (shorttext.count() == 1) {
if (shorttext.size() == 1) {
diffList.append(Diff(Diff::Delete, text1));
diffList.append(Diff(Diff::Insert, text2));
return diffList;
}
}
if (m_currentDiffMode != Differ::CharMode && text1.count() > 80 && text2.count() > 80)
if (m_currentDiffMode != Differ::CharMode && text1.size() > 80 && text2.size() > 80)
return diffNonCharMode(text1, text2);
return diffMyers(text1, text2);
@@ -1054,8 +1053,8 @@ QList<Diff> Differ::preprocess2AndDiff(const QString &text1, const QString &text
QList<Diff> Differ::diffMyers(const QString &text1, const QString &text2)
{
const int n = text1.count();
const int m = text2.count();
const int n = text1.size();
const int m = text2.size();
const bool odd = (n + m) % 2;
const int D = odd ? (n + m) / 2 + 1 : (n + m) / 2;
const int delta = n - m;
@@ -1191,12 +1190,12 @@ QList<Diff> Differ::diffNonCharMode(const QString &text1, const QString &text2)
QString lastDelete;
QString lastInsert;
QList<Diff> newDiffList;
for (int i = 0; i <= diffList.count(); i++) {
for (int i = 0; i <= diffList.size(); i++) {
if (m_future && m_future->isCanceled()) {
m_currentDiffMode = diffMode;
return {};
}
const Diff diffItem = i < diffList.count()
const Diff diffItem = i < diffList.size()
? diffList.at(i)
: Diff(Diff::Equal); // dummy, ensure we process to the end
// even when diffList doesn't end with equality
@@ -1240,14 +1239,14 @@ int Differ::findSubtextEnd(const QString &text,
if (m_currentDiffMode == Differ::LineMode) {
int subtextEnd = text.indexOf('\n', subtextStart);
if (subtextEnd == -1)
subtextEnd = text.count() - 1;
subtextEnd = text.size() - 1;
return ++subtextEnd;
} else if (m_currentDiffMode == Differ::WordMode) {
if (!text.at(subtextStart).isLetter())
return subtextStart + 1;
int i = subtextStart + 1;
const int count = text.count();
const int count = text.size();
while (i < count && text.at(i).isLetter())
i++;
return i;
@@ -1262,7 +1261,7 @@ QString Differ::encode(const QString &text,
int subtextStart = 0;
int subtextEnd = -1;
QString codes;
while (subtextEnd < text.count()) {
while (subtextEnd < text.size()) {
subtextEnd = findSubtextEnd(text, subtextStart);
const QString line = text.mid(subtextStart, subtextEnd - subtextStart);
subtextStart = subtextEnd;
@@ -1271,8 +1270,8 @@ QString Differ::encode(const QString &text,
codes += QChar(static_cast<ushort>(lineToCode->value(line)));
} else {
lines->append(line);
lineToCode->insert(line, lines->count() - 1);
codes += QChar(static_cast<ushort>(lines->count() - 1));
lineToCode->insert(line, lines->size() - 1);
codes += QChar(static_cast<ushort>(lines->size() - 1));
}
}
return codes;
@@ -1283,8 +1282,8 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
QString lastDelete;
QString lastInsert;
QList<Diff> newDiffList;
for (int i = 0; i <= diffList.count(); i++) {
Diff diff = i < diffList.count()
for (int i = 0; i <= diffList.size(); i++) {
Diff diff = i < diffList.size()
? diffList.at(i)
: Diff(Diff::Equal); // dummy, ensure we process to the end
// even when diffList doesn't end with equality
@@ -1314,8 +1313,8 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
const int suffixCount = commonSuffix(lastDelete, lastInsert);
if (suffixCount) {
const QString suffix = lastDelete.right(suffixCount);
lastDelete = lastDelete.left(lastDelete.count() - suffixCount);
lastInsert = lastInsert.left(lastInsert.count() - suffixCount);
lastDelete = lastDelete.left(lastDelete.size() - suffixCount);
lastInsert = lastInsert.left(lastInsert.size() - suffixCount);
diff.text.prepend(suffix);
}
@@ -1342,7 +1341,7 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
}
QList<Diff> squashedDiffList = squashEqualities(newDiffList);
if (squashedDiffList.count() != newDiffList.count())
if (squashedDiffList.size() != newDiffList.size())
return merge(squashedDiffList);
return squashedDiffList;
@@ -1363,8 +1362,8 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
int inserts = 0;
// equality index, equality data
QList<EqualityData> equalities;
for (int i = 0; i <= diffList.count(); i++) {
const Diff diff = i < diffList.count()
for (int i = 0; i <= diffList.size(); i++) {
const Diff diff = i < diffList.size()
? diffList.at(i)
: Diff(Diff::Equal); // dummy, ensure we process to the end
// even when diffList doesn't end with equality
@@ -1374,10 +1373,10 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
previousData.deletesAfter = deletes;
previousData.insertsAfter = inserts;
}
if (i < diffList.count()) { // don't insert dummy
if (i < diffList.size()) { // don't insert dummy
EqualityData data;
data.equalityIndex = i;
data.textCount = diff.text.count();
data.textCount = diff.text.size();
data.deletesBefore = deletes;
data.insertsBefore = inserts;
equalities.append(data);
@@ -1386,15 +1385,15 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
}
} else {
if (diff.command == Diff::Delete)
deletes += diff.text.count();
deletes += diff.text.size();
else if (diff.command == Diff::Insert)
inserts += diff.text.count();
inserts += diff.text.size();
}
}
QMap<int, bool> equalitiesToBeSplit;
int i = 0;
while (i < equalities.count()) {
while (i < equalities.size()) {
const EqualityData &data = equalities.at(i);
if (data.textCount <= qMax(data.deletesBefore, data.insertsBefore)
&& data.textCount <= qMax(data.deletesAfter, data.insertsAfter)) {
@@ -1403,7 +1402,7 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
previousData.deletesAfter += data.textCount + data.deletesAfter;
previousData.insertsAfter += data.textCount + data.insertsAfter;
}
if (i < equalities.count() - 1) {
if (i < equalities.size() - 1) {
EqualityData &nextData = equalities[i + 1];
nextData.deletesBefore += data.textCount + data.deletesBefore;
nextData.insertsBefore += data.textCount + data.insertsBefore;
@@ -1418,7 +1417,7 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
}
QList<Diff> newDiffList;
for (int i = 0; i < diffList.count(); i++) {
for (int i = 0; i < diffList.size(); i++) {
const Diff &diff = diffList.at(i);
if (equalitiesToBeSplit.contains(i)) {
newDiffList.append(Diff(Diff::Delete, diff.text));
@@ -1433,7 +1432,7 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
{
if (diffList.count() < 3) // we need at least 3 items
if (diffList.size() < 3) // we need at least 3 items
return diffList;
QList<Diff> newDiffList;
@@ -1441,7 +1440,7 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
Diff thisDiff = diffList.at(1);
Diff nextDiff = diffList.at(2);
int i = 2;
while (i < diffList.count()) {
while (i < diffList.size()) {
if (prevDiff.command == Diff::Equal
&& nextDiff.command == Diff::Equal) {
@@ -1453,9 +1452,9 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
// Shift the edit as far left as possible
const int suffixCount = commonSuffix(equality1, edit);
if (suffixCount) {
const QString commonString = edit.mid(edit.count() - suffixCount);
equality1 = equality1.left(equality1.count() - suffixCount);
edit = commonString + edit.left(edit.count() - suffixCount);
const QString commonString = edit.mid(edit.size() - suffixCount);
equality1 = equality1.left(equality1.size() - suffixCount);
edit = commonString + edit.left(edit.size() - suffixCount);
equality2 = commonString + equality2;
}
@@ -1488,7 +1487,7 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
newDiffList.append(prevDiff); // append modified equality1
if (bestEquality2.isEmpty()) {
i++;
if (i < diffList.count())
if (i < diffList.size())
nextDiff = diffList.at(i); // omit equality2
}
} else {
@@ -1497,11 +1496,11 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
prevDiff = thisDiff;
thisDiff = nextDiff;
i++;
if (i < diffList.count())
if (i < diffList.size())
nextDiff = diffList.at(i);
}
newDiffList.append(prevDiff);
if (i == diffList.count())
if (i == diffList.size())
newDiffList.append(thisDiff);
return newDiffList;
}

View File

@@ -1,23 +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 <functional>
namespace Utils {
class ExecuteOnDestruction
{
public:
ExecuteOnDestruction() noexcept : destructionCode([] {}) {}
ExecuteOnDestruction(std::function<void()> code) : destructionCode(std::move(code)) {}
~ExecuteOnDestruction() { if (destructionCode) destructionCode(); }
void reset(std::function<void()> code) { destructionCode = std::move(code); }
private:
std::function<void()> destructionCode;
};
} // Utils

View File

@@ -151,12 +151,12 @@ bool FileNameValidatingLineEdit::validateFileNameExtension(const QString &fileNa
if (!requiredExtensions.isEmpty()) {
for (const QString &requiredExtension : requiredExtensions) {
QString extension = QLatin1Char('.') + requiredExtension;
if (fileName.endsWith(extension, Qt::CaseSensitive) && extension.count() < fileName.count())
if (fileName.endsWith(extension, Qt::CaseSensitive) && extension.size() < fileName.size())
return true;
}
if (errorMessage) {
if (requiredExtensions.count() == 1)
if (requiredExtensions.size() == 1)
*errorMessage = Tr::tr("File extension %1 is required:").arg(requiredExtensions.first());
else
*errorMessage = Tr::tr("File extensions %1 are required:").arg(requiredExtensions.join(QLatin1String(", ")));

View File

@@ -133,7 +133,7 @@ bool FileSaverBase::write(const QByteArray &bytes)
{
if (m_hasError)
return false;
return setResult(m_file->write(bytes) == bytes.count());
return setResult(m_file->write(bytes) == bytes.size());
}
bool FileSaverBase::setResult(bool ok)

View File

@@ -201,7 +201,7 @@ void HighlightingItemDelegate::drawText(QPainter *painter,
static QString replaceNewLine(QString text)
{
static const QChar nl = '\n';
for (int i = 0; i < text.count(); ++i)
for (int i = 0; i < text.size(); ++i)
if (text.at(i) == nl)
text[i] = QChar::LineSeparator;
return text;

View File

@@ -77,7 +77,7 @@ public:
MacroExpander::PrefixFunction pf = it.value();
if (found)
*found = true;
return pf(QString::fromUtf8(variable.mid(it.key().count())));
return pf(QString::fromUtf8(variable.mid(it.key().size())));
}
}
if (found)

View File

@@ -4,13 +4,9 @@
#include "networkaccessmanager.h"
#include <QCoreApplication>
#include <QLibraryInfo>
#include <QLocale>
#include <QNetworkReply>
#ifdef Q_OS_UNIX
#include <sys/utsname.h>
#endif
#include <QSysInfo>
/*!
\class Utils::NetworkAccessManager
@@ -75,5 +71,4 @@ QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkR
return QNetworkAccessManager::createRequest(op, req, outgoingData);
}
} // namespace utils

View File

@@ -7,10 +7,6 @@
#include <QNetworkAccessManager>
QT_BEGIN_NAMESPACE
class QUrl;
QT_END_NAMESPACE
namespace Utils {
class QTCREATOR_UTILS_EXPORT NetworkAccessManager : public QNetworkAccessManager

View File

@@ -449,7 +449,7 @@ void OutputFormatter::append(const QString &text, const QTextCharFormat &format)
d->cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
startPos = crPos + 1;
}
if (startPos < text.count())
if (startPos < text.size())
d->cursor.insertText(text.mid(startPos), format);
}

View File

@@ -66,7 +66,7 @@ public:
return std::invoke(std::forward<Function>(function), std::forward<Args>(args)...);
QElapsedTimer timer;
timer.start();
auto cleanup = qScopeGuard([this, &timer] {
const QScopeGuard cleanup([this, &timer] {
const qint64 currentNsecs = timer.nsecsElapsed();
const bool mainThread = isMainThread();
const int hitThisAll = m_hitThisAll.fetch_add(1) + 1;
@@ -134,7 +134,7 @@ private:
}
static QString formatField(int number, int fieldWidth, const QString &suffix = {})
{
return QString("%1%2").arg(number, fieldWidth - suffix.count()).arg(suffix);
return QString("%1%2").arg(number, fieldWidth - suffix.size()).arg(suffix);
}
static int toMs(quint64 nsesc) // nanoseconds to miliseconds

View File

@@ -303,7 +303,7 @@ bool ProjectIntroPage::validateProjectName(const QString &name, QString *errorMe
// if pos is set by validate it is cought at the bottom where it shows
// a more detailed error message
if (validatorState != QValidator::Acceptable && (pos == -1 || pos >= name.count())) {
if (validatorState != QValidator::Acceptable && (pos == -1 || pos >= name.size())) {
if (errorMessage) {
if (d->m_projectNameValidatorUserMessage.isEmpty())
*errorMessage = Tr::tr("Project name is invalid.");

View File

@@ -235,9 +235,9 @@ QString TemplateEngine::processText(MacroExpander *expander, const QString &inpu
// Expand \n, \t and handle line continuation:
QString result;
result.reserve(out.count());
result.reserve(out.size());
bool isEscaped = false;
for (int i = 0; i < out.count(); ++i) {
for (int i = 0; i < out.size(); ++i) {
const QChar c = out.at(i);
if (isEscaped) {

View File

@@ -112,7 +112,14 @@ const char kTerminalExecuteOptionsKey[] = "General/Terminal/ExecuteOptions";
TerminalCommand TerminalCommand::terminalEmulator()
{
if (s_settings && HostOsInfo::isAnyUnixHost() && s_settings->contains(kTerminalCommandKey)) {
return {FilePath::fromSettings(s_settings->value(kTerminalCommandKey)),
FilePath command = FilePath::fromSettings(s_settings->value(kTerminalCommandKey));
// TODO Remove some time after Qt Creator 11
// Work around Qt Creator <= 10 writing the default terminal to the settings.
if (HostOsInfo::isMacHost() && command.endsWith("openTerminal.py"))
command = FilePath::fromString("Terminal.app");
return {command,
s_settings->value(kTerminalOpenOptionsKey).toString(),
s_settings->value(kTerminalExecuteOptionsKey).toString()};
}

View File

@@ -109,7 +109,6 @@ Project {
"environmentmodel.h",
"execmenu.cpp",
"execmenu.h",
"executeondestruction.h",
"externalterminalprocessimpl.cpp",
"externalterminalprocessimpl.h",
"fadingindicator.cpp",

View File

@@ -264,13 +264,13 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
m_extraAppParams = runControl->commandLine().arguments();
if (auto aspect = runControl->aspect(Constants::ANDROID_AM_START_ARGS)) {
QTC_CHECK(aspect->value.type() == QVariant::String);
QTC_CHECK(aspect->value.typeId() == QVariant::String);
const QString startArgs = aspect->value.toString();
m_amStartExtraArgs = ProcessArgs::splitArgs(startArgs, OsTypeOtherUnix);
}
if (auto aspect = runControl->aspect(Constants::ANDROID_PRESTARTSHELLCMDLIST)) {
QTC_CHECK(aspect->value.type() == QVariant::String);
QTC_CHECK(aspect->value.typeId() == QVariant::String);
const QStringList commands = aspect->value.toString().split('\n', Qt::SkipEmptyParts);
for (const QString &shellCmd : commands)
m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd));
@@ -341,7 +341,7 @@ bool AndroidRunnerWorker::uploadDebugServer(const QString &debugServerFileName)
}
const QString tempDebugServerPath = tempDebugServerPathTemplate.arg(count);
auto cleanUp = qScopeGuard([this, tempDebugServerPath] {
const QScopeGuard cleanup([this, tempDebugServerPath] {
if (!runAdb({"shell", "rm", "-f", tempDebugServerPath}))
qCDebug(androidRunWorkerLog) << "Debug server cleanup failed.";
});

View File

@@ -54,10 +54,10 @@ static QString formatResult(double value)
QString beforeDecimalPoint = QString::number(value, 'f', 0);
QString afterDecimalPoint = QString::number(value, 'f', 20);
afterDecimalPoint.remove(0, beforeDecimalPoint.count() + 1);
afterDecimalPoint.remove(0, beforeDecimalPoint.size() + 1);
const int beforeUse = qMin(beforeDecimalPoint.count(), significantDigits);
const int beforeRemove = beforeDecimalPoint.count() - beforeUse;
const int beforeUse = qMin(beforeDecimalPoint.size(), significantDigits);
const int beforeRemove = beforeDecimalPoint.size() - beforeUse;
beforeDecimalPoint.chop(beforeRemove);
for (int i = 0; i < beforeRemove; ++i)
@@ -67,12 +67,12 @@ static QString formatResult(double value)
if (beforeDecimalPoint == QString("0") && !afterDecimalPoint.isEmpty()) {
++afterUse;
int i = 0;
while (i < afterDecimalPoint.count() && afterDecimalPoint.at(i) == '0')
while (i < afterDecimalPoint.size() && afterDecimalPoint.at(i) == '0')
++i;
afterUse += i;
}
const int afterRemove = afterDecimalPoint.count() - afterUse;
const int afterRemove = afterDecimalPoint.size() - afterUse;
afterDecimalPoint.chop(afterRemove);
QString result = beforeDecimalPoint;

View File

@@ -124,7 +124,7 @@ QList<QWidget *> AxivionOutputPane::toolBarWidgets() const
{
QList<QWidget *> buttons;
auto showDashboard = new QToolButton(m_outputWidget);
showDashboard->setIcon(Utils::Icons::ONLINE_TOOLBAR.icon());
showDashboard->setIcon(Utils::Icons::HOME_TOOLBAR.icon());
showDashboard->setToolTip(Tr::tr("Show dashboard"));
connect(showDashboard, &QToolButton::clicked, this, [this]{
QTC_ASSERT(m_outputWidget, return);

View File

@@ -56,6 +56,7 @@ GeneralSettings::GeneralSettings()
st
};
});
readSettings();
}
QList<MimeType> GeneralSettings::allowedMimeTypes() const

View File

@@ -230,14 +230,22 @@ public:
void enableCodeActionsInline() {insert(u"codeActionsInline", true);}
};
class InactiveRegionsCapabilities : public JsonObject
{
public:
using JsonObject::JsonObject;
void enableInactiveRegionsSupport() { insert(u"inactiveRegions", true); }
};
class ClangdTextDocumentClientCapabilities : public TextDocumentClientCapabilities
{
public:
using TextDocumentClientCapabilities::TextDocumentClientCapabilities;
void setPublishDiagnostics(const DiagnosticsCapabilities &caps)
{ insert(u"publishDiagnostics", caps); }
void setInactiveRegionsCapabilities(const InactiveRegionsCapabilities &caps)
{ insert(u"inactiveRegionsCapabilities", caps); }
};
static qint64 getRevision(const TextDocument *doc)
@@ -428,6 +436,9 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, c
diagnostics.enableCategorySupport();
diagnostics.enableCodeActionsInline();
clangdTextCaps.setPublishDiagnostics(diagnostics);
InactiveRegionsCapabilities inactiveRegions;
inactiveRegions.enableInactiveRegionsSupport();
clangdTextCaps.setInactiveRegionsCapabilities(inactiveRegions);
std::optional<TextDocumentClientCapabilities::CompletionCapabilities> completionCaps
= textCaps->completion();
if (completionCaps)
@@ -456,6 +467,9 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, c
const Utils::FilePath &filePath) {
gatherHelpItemForTooltip(response, filePath);
});
registerCustomMethod(inactiveRegionsMethodName(), [this](const JsonRpcMessage &msg) {
handleInactiveRegions(this, msg);
});
connect(this, &Client::workDone, this,
[this, p = QPointer(project)](const ProgressToken &token) {
@@ -692,7 +706,8 @@ class ClangdDiagnosticManager : public LanguageClient::DiagnosticManager
return Utils::filtered(diagnostics, [](const Diagnostic &diag){
const Diagnostic::Code code = diag.code().value_or(Diagnostic::Code());
const QString * const codeString = std::get_if<QString>(&code);
return !codeString || *codeString != "drv_unknown_argument";
return !codeString || (*codeString != "drv_unknown_argument"
&& !codeString->startsWith("drv_unsupported_opt"));
});
}

View File

@@ -330,6 +330,8 @@ void doSemanticHighlighting(
styles.mainStyle = C_TYPE;
} else if (token.type == "modifier") {
styles.mainStyle = C_KEYWORD;
} else if (token.type == "label") {
styles.mainStyle = C_LABEL;
} else if (token.type == "typeParameter") {
// clangd reports both type and non-type template parameters as type parameters,
// but the latter can be distinguished by the readonly modifier.
@@ -396,7 +398,10 @@ void doSemanticHighlighting(
}
};
auto results = QtConcurrent::blockingMapped<HighlightingResults>(tokens, safeToResult);
const QList<BlockRange> ifdefedOutBlocks = cleanupDisabledCode(results, &doc, docContents);
const bool handleInactiveCode = clangdMajorVersion < 17;
QList<BlockRange> ifdefedOutBlocks;
if (handleInactiveCode)
ifdefedOutBlocks = cleanupDisabledCode(results, &doc, docContents);
ExtraHighlightingResultsCollector(promise, results, filePath, ast, &doc, docContents,
clangdVersion).collect();
Utils::erase(results, [](const HighlightingResult &res) {
@@ -405,10 +410,12 @@ void doSemanticHighlighting(
});
if (!promise.isCanceled()) {
qCInfo(clangdLogHighlight) << "reporting" << results.size() << "highlighting results";
if (handleInactiveCode) {
QMetaObject::invokeMethod(textDocument, [textDocument, ifdefedOutBlocks, docRevision] {
if (textDocument && textDocument->document()->revision() == docRevision)
textDocument->setIfdefedOutBlocks(ifdefedOutBlocks);
}, Qt::QueuedConnection);
}
QList<Range> virtualRanges;
for (const HighlightingResult &r : results) {
if (r.textStyles.mainStyle != C_VIRTUAL_METHOD)
@@ -953,4 +960,45 @@ void ExtraHighlightingResultsCollector::visitNode(const ClangdAstNode &node)
m_currentFileStatus = prevFileStatus;
}
class InactiveRegionsParams : public JsonObject
{
public:
using JsonObject::JsonObject;
DocumentUri uri() const { return TextDocumentIdentifier(value(u"textDocument")).uri(); }
QList<Range> inactiveRegions() const { return array<Range>(u"regions"); }
};
class InactiveRegionsNotification : public Notification<InactiveRegionsParams>
{
public:
explicit InactiveRegionsNotification(const InactiveRegionsParams &params)
: Notification(inactiveRegionsMethodName(), params) {}
using Notification::Notification;
};
void handleInactiveRegions(LanguageClient::Client *client, const JsonRpcMessage &msg)
{
const auto params = InactiveRegionsNotification(msg.toJsonObject()).params();
if (!params)
return;
TextDocument * const doc = client->documentForFilePath(
params->uri().toFilePath(client->hostPathMapper()));
if (!doc)
return;
const QList<Range> inactiveRegions = params->inactiveRegions();
QList<BlockRange> ifdefedOutBlocks;
for (const Range &r : inactiveRegions) {
const int startPos = r.start().toPositionInDocument(doc->document());
const int endPos = r.end().toPositionInDocument(doc->document()) + 1;
ifdefedOutBlocks.emplaceBack(startPos, endPos);
}
doc->setIfdefedOutBlocks(ifdefedOutBlocks);
}
QString inactiveRegionsMethodName()
{
return "textDocument/inactiveRegions";
}
} // namespace ClangCodeModel::Internal

View File

@@ -12,7 +12,11 @@ template <typename T>
class QPromise;
QT_END_NAMESPACE
namespace LanguageClient { class ExpandedSemanticToken; }
namespace LanguageClient {
class Client;
class ExpandedSemanticToken;
}
namespace LanguageServerProtocol { class JsonRpcMessage; }
namespace TextEditor {
class HighlightingResult;
class TextDocument;
@@ -36,4 +40,9 @@ void doSemanticHighlighting(
const TaskTimer &taskTimer
);
QString inactiveRegionsMethodName();
void handleInactiveRegions(LanguageClient::Client *client,
const LanguageServerProtocol::JsonRpcMessage &msg);
} // namespace ClangCodeModel::Internal

View File

@@ -230,7 +230,7 @@ QString DiagnosticTextInfo::option() const
return QString();
const int index = m_squareBracketStartIndex + 1;
return m_text.mid(index, m_text.count() - index - 1);
return m_text.mid(index, m_text.size() - index - 1);
}
QString DiagnosticTextInfo::category() const

View File

@@ -1225,8 +1225,10 @@ void ClangdTestHighlighting::test_data()
<< QList<int>{C_PUNCTUATION} << int(CppEditor::SemanticHighlighter::AngleBracketClose);
QTest::newRow("macro in struct") << 795 << 9 << 795 << 14
<< QList<int>{C_MACRO, C_DECLARATION} << 0;
if (client()->versionNumber() < QVersionNumber(17)) {
QTest::newRow("#ifdef'ed out code") << 800 << 1 << 800 << 17
<< QList<int>{C_DISABLED_CODE} << 0;
}
QTest::newRow("static function call (object)") << 819 << 5 << 819 << 6
<< QList<int>{C_LOCAL} << 0;
QTest::newRow("static function call (argument)") << 819 << 18 << 819 << 19
@@ -1302,6 +1304,9 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("concept definition") << 1053 << 30 << 1053 << 42
<< QList<int>{C_TYPE, C_DECLARATION} << 0;
QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList<int>{C_TYPE} << 0;
QTest::newRow("label declaration") << 242 << 1 << 242 << 11
<< QList<int>{C_LABEL, C_DECLARATION} << 0;
QTest::newRow("label use") << 244 << 10 << 244 << 20 << QList<int>{C_LABEL} << 0;
}
void ClangdTestHighlighting::test()

View File

@@ -158,8 +158,6 @@ CppEditor::CppCodeStyleSettings ClangFormatFile::toCppCodeStyleSettings(
settings.indentSwitchLabels = style.IndentCaseLabels;
#if LLVM_VERSION_MAJOR >= 11
settings.indentBlocksRelativeToSwitchLabels = style.IndentCaseBlocks;
settings.indentStatementsRelativeToSwitchLabels = style.IndentCaseBlocks;
settings.indentControlFlowRelativeToSwitchLabels = style.IndentCaseBlocks;
#endif
if (style.DerivePointerAlignment
&& ClangFormatSettings::instance().mode() == ClangFormatSettings::Mode::Formatting) {
@@ -200,9 +198,7 @@ void ClangFormatFile::fromCppCodeStyleSettings(const CppEditor::CppCodeStyleSett
m_style.IndentCaseLabels = settings.indentSwitchLabels;
#if LLVM_VERSION_MAJOR >= 11
m_style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels
|| settings.indentStatementsRelativeToSwitchLabels
|| settings.indentControlFlowRelativeToSwitchLabels;
m_style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels;
#endif
if (settings.extraPaddingForConditionsIfConfusingAlign)

View File

@@ -23,7 +23,6 @@
#include <qtsupport/qtkitinformation.h>
#include <utils/environment.h>
#include <utils/executeondestruction.h>
#include <utils/fileutils.h>
#include <QSignalSpy>

View File

@@ -158,7 +158,7 @@ void DocumentClangToolRunner::run()
if (m_projectSettingsUpdate)
disconnect(m_projectSettingsUpdate);
m_taskTree.reset();
QScopeGuard guard([this] { finalize(); });
QScopeGuard cleanup([this] { finalize(); });
auto isEditorForCurrentDocument = [this](const IEditor *editor) {
return editor->document() == m_document;
@@ -216,7 +216,7 @@ void DocumentClangToolRunner::run()
if (tasks.isEmpty())
return;
guard.dismiss();
cleanup.dismiss();
m_taskTree.reset(new TaskTree(tasks));
connect(m_taskTree.get(), &TaskTree::done, this, &DocumentClangToolRunner::finalize);
connect(m_taskTree.get(), &TaskTree::errorOccurred, this, &DocumentClangToolRunner::finalize);

View File

@@ -215,13 +215,13 @@ bool CMakeConfigItem::less(const CMakeConfigItem &a, const CMakeConfigItem &b)
CMakeConfigItem CMakeConfigItem::fromString(const QString &s)
{
// Strip comments (only at start of line!):
int commentStart = s.count();
for (int i = 0; i < s.count(); ++i) {
int commentStart = s.size();
for (int i = 0; i < s.size(); ++i) {
const QChar c = s.at(i);
if (c == ' ' || c == '\t')
continue;
else if ((c == '#')
|| (c == '/' && i < s.count() - 1 && s.at(i + 1) == '/')) {
|| (c == '/' && i < s.size() - 1 && s.at(i + 1) == '/')) {
commentStart = i;
break;
} else {
@@ -234,7 +234,7 @@ CMakeConfigItem CMakeConfigItem::fromString(const QString &s)
int firstPos = -1;
int colonPos = -1;
int equalPos = -1;
for (int i = 0; i < line.count(); ++i) {
for (int i = 0; i < line.size(); ++i) {
const QChar c = s.at(i);
if (firstPos < 0 && !c.isSpace()) {
firstPos = i;
@@ -272,10 +272,10 @@ CMakeConfigItem CMakeConfigItem::fromString(const QString &s)
static QByteArray trimCMakeCacheLine(const QByteArray &in) {
int start = 0;
while (start < in.count() && (in.at(start) == ' ' || in.at(start) == '\t'))
while (start < in.size() && (in.at(start) == ' ' || in.at(start) == '\t'))
++start;
return in.mid(start, in.count() - start - 1);
return in.mid(start, in.size() - start - 1);
}
static QByteArrayList splitCMakeCacheLine(const QByteArray &line) {
@@ -371,15 +371,15 @@ CMakeConfig CMakeConfig::fromFile(const Utils::FilePath &cacheFile, QString *err
if (pieces.isEmpty())
continue;
QTC_ASSERT(pieces.count() == 3, continue);
QTC_ASSERT(pieces.size() == 3, continue);
const QByteArray key = pieces.at(0);
const QByteArray type = pieces.at(1);
const QByteArray value = pieces.at(2);
if (key.endsWith("-ADVANCED") && value == "1") {
advancedSet.insert(key.left(key.count() - 9 /* "-ADVANCED" */));
advancedSet.insert(key.left(key.size() - 9 /* "-ADVANCED" */));
} else if (key.endsWith("-STRINGS") && CMakeConfigItem::typeStringToType(type) == CMakeConfigItem::INTERNAL) {
valuesMap[key.left(key.count() - 8) /* "-STRINGS" */] = value;
valuesMap[key.left(key.size() - 8) /* "-STRINGS" */] = value;
} else {
CMakeConfigItem::Type t = CMakeConfigItem::typeStringToType(type);
result << CMakeConfigItem(key, t, documentation, value);
@@ -387,7 +387,7 @@ CMakeConfig CMakeConfig::fromFile(const Utils::FilePath &cacheFile, QString *err
}
// Set advanced flags:
for (int i = 0; i < result.count(); ++i) {
for (int i = 0; i < result.size(); ++i) {
CMakeConfigItem &item = result[i];
item.isAdvanced = advancedSet.contains(item.key);

View File

@@ -157,7 +157,7 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// find the beginning of a filename
QString buffer;
int beginPos = column;
int beginPos = column - 1;
while (beginPos >= 0) {
if (isValidFileNameChar(block, beginPos)) {
buffer.prepend(block.at(beginPos));
@@ -169,7 +169,7 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// find the end of a filename
int endPos = column;
while (endPos < block.count()) {
while (endPos < block.size()) {
if (isValidFileNameChar(block, endPos)) {
buffer.append(block.at(endPos));
endPos++;

View File

@@ -75,22 +75,15 @@ public:
m_comboBox->setEnabled(false);
m_comboBox->setToolTip(ki->description());
const QList<CMakeTool *> tools = CMakeToolManager::cmakeTools();
for (const CMakeTool *tool : tools)
cmakeToolAdded(tool->id());
updateComboBox();
refresh();
connect(m_comboBox, &QComboBox::currentIndexChanged,
this, &CMakeKitAspectWidget::currentCMakeToolChanged);
CMakeToolManager *cmakeMgr = CMakeToolManager::instance();
connect(cmakeMgr, &CMakeToolManager::cmakeAdded,
this, &CMakeKitAspectWidget::cmakeToolAdded);
connect(cmakeMgr, &CMakeToolManager::cmakeRemoved,
this, &CMakeKitAspectWidget::cmakeToolRemoved);
connect(cmakeMgr, &CMakeToolManager::cmakeUpdated,
this, &CMakeKitAspectWidget::cmakeToolUpdated);
connect(cmakeMgr, &CMakeToolManager::cmakeAdded, this, &CMakeKitAspectWidget::refresh);
connect(cmakeMgr, &CMakeToolManager::cmakeRemoved, this, &CMakeKitAspectWidget::refresh);
connect(cmakeMgr, &CMakeToolManager::cmakeUpdated, this, &CMakeKitAspectWidget::refresh);
}
~CMakeKitAspectWidget() override
@@ -112,6 +105,37 @@ private:
void refresh() override
{
const GuardLocker locker(m_ignoreChanges);
m_comboBox->clear();
IDeviceConstPtr device = BuildDeviceKitAspect::device(kit());
const FilePath rootPath = device->rootPath();
const auto list = CMakeToolManager::cmakeTools();
m_comboBox->setEnabled(!list.isEmpty());
if (list.isEmpty()) {
m_comboBox->addItem(Tr::tr("<No CMake Tool available>"), Id().toSetting());
return;
}
const QList<CMakeTool *> same = Utils::filtered(list, [rootPath](CMakeTool *item) {
return item->cmakeExecutable().isSameDevice(rootPath);
});
const QList<CMakeTool *> other = Utils::filtered(list, [rootPath](CMakeTool *item) {
return !item->cmakeExecutable().isSameDevice(rootPath);
});
for (CMakeTool *item : same)
m_comboBox->addItem(item->displayName(), item->id().toSetting());
if (!same.isEmpty() && !other.isEmpty())
m_comboBox->insertSeparator(m_comboBox->count());
for (CMakeTool *item : other)
m_comboBox->addItem(item->displayName(), item->id().toSetting());
CMakeTool *tool = CMakeKitAspect::cmakeTool(m_kit);
m_comboBox->setCurrentIndex(tool ? indexOf(tool->id()) : -1);
}
@@ -125,58 +149,6 @@ private:
return -1;
}
void updateComboBox()
{
// remove unavailable cmake tool:
int pos = indexOf(Id());
if (pos >= 0)
m_comboBox->removeItem(pos);
if (m_comboBox->count() == 0) {
m_comboBox->addItem(Tr::tr("<No CMake Tool available>"), Id().toSetting());
m_comboBox->setEnabled(false);
} else {
m_comboBox->setEnabled(true);
}
}
void cmakeToolAdded(Id id)
{
const CMakeTool *tool = CMakeToolManager::findById(id);
QTC_ASSERT(tool, return);
m_comboBox->addItem(tool->displayName(), tool->id().toSetting());
updateComboBox();
refresh();
}
void cmakeToolUpdated(Id id)
{
const int pos = indexOf(id);
QTC_ASSERT(pos >= 0, return);
const CMakeTool *tool = CMakeToolManager::findById(id);
QTC_ASSERT(tool, return);
m_comboBox->setItemText(pos, tool->displayName());
}
void cmakeToolRemoved(Id id)
{
const int pos = indexOf(id);
QTC_ASSERT(pos >= 0, return);
{
// do not handle the current index changed signal
const GuardLocker locker(m_ignoreChanges);
m_comboBox->removeItem(pos);
}
// update the checkbox and set the current index
updateComboBox();
refresh();
}
void currentCMakeToolChanged(int index)
{
if (m_ignoreChanges.isLocked())

View File

@@ -431,7 +431,7 @@ static QVector<ToolChainDescription> extractToolChainsFromCache(const CMakeConfi
for (const CMakeConfigItem &i : config) {
if (!i.key.startsWith("CMAKE_") || !i.key.endsWith("_COMPILER"))
continue;
const QByteArray language = i.key.mid(6, i.key.count() - 6 - 9); // skip "CMAKE_" and "_COMPILER"
const QByteArray language = i.key.mid(6, i.key.size() - 6 - 9); // skip "CMAKE_" and "_COMPILER"
Id languageId;
if (language == "CXX") {
haveCCxxCompiler = true;

View File

@@ -2,7 +2,7 @@
\"Name\" : \"Copilot\",
\"Version\" : \"$$QTCREATOR_VERSION\",
\"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
\"Experimental\" : true,
\"DisabledByDefault\" : true,
\"Vendor\" : \"The Qt Company Ltd\",
\"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\",
\"License\" : [ \"Commercial Usage\",

View File

@@ -15,6 +15,7 @@
#include <utils/utilsicons.h>
#include <QPushButton>
#include <QScopeGuard>
#include <QToolBar>
#include <QToolButton>
@@ -117,7 +118,7 @@ void CopilotHoverHandler::identifyMatch(TextEditorWidget *editorWidget,
int pos,
ReportPriority report)
{
auto reportNone = qScopeGuard([&] { report(Priority_None); });
QScopeGuard cleanup([&] { report(Priority_None); });
if (!editorWidget->suggestionVisible())
return;
@@ -133,7 +134,7 @@ void CopilotHoverHandler::identifyMatch(TextEditorWidget *editorWidget,
if (completions.isEmpty())
return;
reportNone.dismiss();
cleanup.dismiss();
report(Priority_Suggestion);
}

View File

@@ -3325,7 +3325,7 @@ IEditor *EditorManager::openEditorWithContents(Id editorId,
EditorManager::gotoOtherSplit();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
const auto cleanup = qScopeGuard(&QApplication::restoreOverrideCursor);
const QScopeGuard cleanup(&QApplication::restoreOverrideCursor);
const QString title = makeTitleUnique(titlePattern);

View File

@@ -65,6 +65,7 @@ FindToolWindow::FindToolWindow(QWidget *parent)
m_searchTerm = new FancyLineEdit(this);
m_searchTerm->setFiltering(true);
m_searchTerm->setPlaceholderText({});
m_searchLabel = new QLabel(this);
m_searchLabel->setText(Tr::tr("Search f&or:", nullptr));

View File

@@ -28,7 +28,7 @@ static std::pair<int, QString> lineNumberInfo(const QStyleOptionViewItem &option
if (lineNumber < 1)
return {0, {}};
const QString lineNumberText = QString::number(lineNumber);
const int lineNumberDigits = qMax(minimumLineNumberDigits, lineNumberText.count());
const int lineNumberDigits = qMax(minimumLineNumberDigits, lineNumberText.size());
const int fontWidth = option.fontMetrics.horizontalAdvance(QString(lineNumberDigits, QLatin1Char('0')));
const QStyle *style = option.widget ? option.widget->style() : QApplication::style();
return {lineNumberAreaHorizontalPadding + fontWidth + lineNumberAreaHorizontalPadding

View File

@@ -107,6 +107,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
Form form;
form.addRow({Tr::tr("Color:"), m_colorButton, resetColorButton, st});
form.addRow({Tr::tr("Theme:"), m_themeChooser});
form.addRow({Tr::tr("Toolbar style:"), m_toolbarStyleBox, st});
form.addRow({Tr::tr("Language:"), m_languageBox, st});
if (!Utils::HostOsInfo::isMacHost()) {
@@ -125,7 +126,6 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
form.addRow({empty, m_showShortcutsInContextMenus});
form.addRow({Row{m_resetWarningsButton, st}});
form.addRow({Tr::tr("Text codec for tools:"), m_codecBox, st});
form.addRow({Tr::tr("Toolbar Style:"), m_toolbarStyleBox, st});
Column{Group{title(Tr::tr("User Interface")), form}}.attachTo(this);
fillLanguageBox();
@@ -152,7 +152,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
static bool hasQmFilesForLocale(const QString &locale, const QString &creatorTrPath)
{
static const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
static const QString qtTrPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
const QString trFile = QLatin1String("/qt_") + locale + QLatin1String(".qm");
return QFile::exists(qtTrPath + trFile) || QFile::exists(creatorTrPath + trFile);

View File

@@ -177,7 +177,7 @@ QString HelpItem::extractContent(bool extended) const
// include separators for major vs minor vs patch version.
static QVersionNumber qtVersionHeuristic(const QString &digits)
{
if (digits.count() > 6 || digits.count() < 3)
if (digits.size() > 6 || digits.size() < 3)
return {}; // suspicious version number
for (const QChar &digit : digits)
@@ -188,7 +188,7 @@ static QVersionNumber qtVersionHeuristic(const QString &digits)
// When we have 4 digits, we split it like: ABCD -> A.BC.D
// When we have 5 digits, we split it like: ABCDE -> A.BC.DE
// When we have 6 digits, we split it like: ABCDEF -> AB.CD.EF
switch (digits.count()) {
switch (digits.size()) {
case 3:
return QVersionNumber(digits.mid(0, 1).toInt(),
digits.mid(1, 1).toInt(),

View File

@@ -92,6 +92,8 @@ protected:
void setupContext(const Context &context, QWidget *widget);
void setZoomButtonsEnabled(bool enabled);
IContext *m_context = nullptr;
private:
virtual void updateFilter();
@@ -108,7 +110,6 @@ private:
QAction *m_filterActionCaseSensitive = nullptr;
QAction *m_invertFilterAction = nullptr;
Utils::FancyLineEdit *m_filterOutputLineEdit = nullptr;
IContext *m_context = nullptr;
bool m_filterRegexp = false;
bool m_invertFilter = false;
Qt::CaseSensitivity m_filterCaseSensitivity = Qt::CaseInsensitive;

View File

@@ -490,7 +490,7 @@ void LocatorMatcher::start()
}
};
d->m_taskTree->setupRoot(root);
d->m_taskTree->setRecipe(root);
const auto onFinish = [this](bool success) {
return [this, success] {

View File

@@ -15,7 +15,6 @@
#include <QJSEngine>
#include <QPair>
#include <QPointer>
#include <QScopeGuard>
#include <chrono>

View File

@@ -105,7 +105,7 @@ static QList<FilterRuleSpec> fetchOriginalRules()
};
Utils::FilePath iniFile = Utils::FilePath::fromString(
QLibraryInfo::location(QLibraryInfo::DataPath)).pathAppended("qtlogging.ini");
QLibraryInfo::path(QLibraryInfo::DataPath)).pathAppended("qtlogging.ini");
if (iniFile.exists())
appendRulesFromFile(iniFile.toString());

View File

@@ -591,7 +591,7 @@ void LoggingViewManagerWidget::saveLoggingsToFile() const
{
// should we just let it continue without temporarily disabling?
const bool enabled = m_manager->isEnabled();
const auto cleanup = qScopeGuard([this, enabled] { m_manager->setEnabled(enabled); });
const QScopeGuard cleanup([this, enabled] { m_manager->setEnabled(enabled); });
if (enabled)
m_manager->setEnabled(false);
const Utils::FilePath fp = Utils::FileUtils::getSaveFilePath(ICore::dialogParent(),

View File

@@ -63,6 +63,7 @@
#include <utils/stylehelper.h>
#include <utils/theme/theme.h>
#include <utils/touchbar/touchbar.h>
#include <utils/terminalcommand.h>
#include <utils/utilsicons.h>
#include <QAbstractProxyModel>
@@ -1228,6 +1229,14 @@ void MainWindow::saveSettings()
EditorManagerPrivate::saveSettings();
m_leftNavigationWidget->saveSettings(settings);
m_rightNavigationWidget->saveSettings(settings);
// TODO Remove some time after Qt Creator 11
// Work around Qt Creator <= 10 writing the default terminal to the settings.
// TerminalCommand writes the terminal to the settings when changing it, which usually is
// enough. But because of the bug in Qt Creator <= 10 we want to clean up the settings
// even if the user never touched the terminal setting.
if (HostOsInfo::isMacHost())
TerminalCommand::setTerminalEmulator(TerminalCommand::terminalEmulator());
}
void MainWindow::saveWindowSettings()

View File

@@ -83,9 +83,7 @@ public:
class MimeTypeSettingsModel : public QAbstractTableModel
{
public:
enum class Role {
DefaultHandler = Qt::UserRole
};
enum class Role { DefaultHandler = Qt::UserRole, MimeType };
MimeTypeSettingsModel(QObject *parent = nullptr)
: QAbstractTableModel(parent) {}
@@ -158,6 +156,8 @@ QVariant MimeTypeSettingsModel::data(const QModelIndex &modelIndex, int role) co
}
}
return QVariant();
} else if (role == int(Role::MimeType)) {
return QVariant::fromValue(m_mimeTypes.at(modelIndex.row()));
}
return QVariant();
}
@@ -222,6 +222,37 @@ void MimeTypeSettingsModel::resetUserDefaults()
endResetModel();
}
class MimeFilterModel : public QSortFilterProxyModel
{
public:
explicit MimeFilterModel(QObject *parent = nullptr);
protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
};
MimeFilterModel::MimeFilterModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
}
bool MimeFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
const QModelIndex &index = sourceModel()->index(source_row, 0, source_parent);
const MimeType mt
= sourceModel()->data(index, int(MimeTypeSettingsModel::Role::MimeType)).value<MimeType>();
const QModelIndex &handlerIndex = sourceModel()->index(source_row, 1, source_parent);
const QString handlerText = sourceModel()->data(handlerIndex, Qt::DisplayRole).toString();
const QStringList matchStrings = mt.globPatterns() << mt.name() << handlerText;
const QRegularExpression regex = filterRegularExpression();
for (const QString &str : matchStrings) {
if (regex.match(str).hasMatch())
return true;
}
return false;
}
// MimeTypeSettingsPrivate
class MimeTypeSettingsPrivate : public QObject
{
@@ -256,7 +287,7 @@ public:
static UserMimeTypeHash m_userModifiedMimeTypes; // these are already in mime database
MimeTypeSettingsModel *m_model;
QSortFilterProxyModel *m_filterModel;
MimeFilterModel *m_filterModel;
UserMimeTypeHash m_pendingModifiedMimeTypes; // currently edited in the options page
QString m_filterPattern;
QPointer<QWidget> m_widget;
@@ -277,10 +308,11 @@ MimeTypeSettingsPrivate::UserMimeTypeHash MimeTypeSettingsPrivate::m_userModifie
MimeTypeSettingsPrivate::MimeTypeSettingsPrivate()
: m_model(new MimeTypeSettingsModel(this))
, m_filterModel(new QSortFilterProxyModel(this))
, m_filterModel(new MimeFilterModel(this))
{
m_filterModel->setSourceModel(m_model);
m_filterModel->setFilterKeyColumn(-1);
m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
connect(ICore::instance(), &ICore::saveSettingsRequested,
this, &MimeTypeSettingsPrivate::writeUserModifiedMimeTypes);
}
@@ -317,6 +349,7 @@ void MimeTypeSettingsPrivate::configureUi(QWidget *w)
auto filterLineEdit = new FancyLineEdit;
filterLineEdit->setObjectName("filterLineEdit");
filterLineEdit->setFiltering(true);
m_filterModel->setFilterWildcard({});
m_mimeTypesTreeView = new QTreeView;
m_mimeTypesTreeView->setObjectName("mimeTypesTreeView");

View File

@@ -99,7 +99,7 @@ static int indexOf(Id id)
void ModeManagerPrivate::showMenu(int index, QMouseEvent *event)
{
QTC_ASSERT(m_modes.at(index)->menu(), return);
m_modes.at(index)->menu()->popup(event->globalPos());
m_modes.at(index)->menu()->popup(event->globalPosition().toPoint());
}
ModeManager::ModeManager(Internal::MainWindow *mainWindow,

View File

@@ -80,7 +80,7 @@ public:
QTC_ASSERT((topLevel.isEmpty() && !vc) || (!topLevel.isEmpty() && vc), return);
FilePath tmpDir = dir;
while (tmpDir.toString().count() >= topLevelString.count() && !tmpDir.isEmpty()) {
while (tmpDir.toString().size() >= topLevelString.size() && !tmpDir.isEmpty()) {
m_cachedMatches.insert(tmpDir, {vc, topLevel});
// if no vc was found, this might mean we're inside a repo internal directory (.git)
// Cache only input directory, not parents
@@ -237,7 +237,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const FilePath &inpu
for (auto i = allThatCanManage.constBegin(); i != allThatCanManage.constEnd(); ++i) {
const QString firstString = i->first.toString();
// If topLevel was already cached for another VC, skip this one
if (tmpDir.toString().count() < firstString.count())
if (tmpDir.toString().size() < firstString.size())
continue;
d->cache(i->second, i->first, tmpDir);
tmpDir = i->first.parentDir();
@@ -458,7 +458,7 @@ static FileHash makeHash(const QStringList &list)
FileHash result;
for (const QString &i : list) {
QStringList parts = i.split(QLatin1Char(':'));
QTC_ASSERT(parts.count() == 2, continue);
QTC_ASSERT(parts.size() == 2, continue);
result.insert(FilePath::fromString(QString::fromLatin1(TEST_PREFIX) + parts.at(0)),
FilePath::fromString(QString::fromLatin1(TEST_PREFIX) + parts.at(1)));
}
@@ -547,7 +547,7 @@ void CorePlugin::testVcsManager()
// qDebug() << "Expecting:" << result;
const QStringList split = result.split(QLatin1Char(':'));
QCOMPARE(split.count(), 4);
QCOMPARE(split.size(), 4);
QVERIFY(split.at(3) == QLatin1String("*") || split.at(3) == QLatin1String("-"));

View File

@@ -254,8 +254,10 @@ void BuiltinEditorDocumentProcessor::onParserFinished(CPlusPlus::Document::Ptr d
qCDebug(log) << "document parsed" << document->filePath() << document->editorRevision();
// Emit ifdefed out blocks
if (!m_semanticHighlightingChecker || m_semanticHighlightingChecker()) {
const auto ifdefoutBlocks = toTextEditorBlocks(document->skippedBlocks());
emit ifdefedOutBlocksUpdated(revision(), ifdefoutBlocks);
}
// Store parser warnings
m_codeWarnings = toTextEditorSelections(document->diagnosticMessages(), textDocument());

View File

@@ -8,7 +8,6 @@
#include "wrappablelineedit.h"
#include <utils/environment.h>
#include <utils/executeondestruction.h>
#include <utils/infolabel.h>
#include <utils/layoutbuilder.h>
#include <utils/stringutils.h>
@@ -21,6 +20,7 @@
#include <QLabel>
#include <QPushButton>
#include <QPushButton>
#include <QScopeGuard>
#include <QTabWidget>
#include <QTreeView>
@@ -323,7 +323,7 @@ void ClangDiagnosticConfigsWidget::sync()
return;
disconnectClangOnlyOptionsChanged();
ExecuteOnDestruction e([this] { connectClangOnlyOptionsChanged(); });
const QScopeGuard cleanup([this] { connectClangOnlyOptionsChanged(); });
// Update main button row
const ClangDiagnosticConfig &config = currentConfig();

View File

@@ -875,7 +875,8 @@ void CompilerOptionsBuilder::evaluateCompilerFlags()
|| option.startsWith("/M", Qt::CaseSensitive)
|| option.startsWith(includeUserPathOption)
|| option.startsWith(includeSystemPathOption)
|| option.startsWith(includeUserPathOptionWindows)) {
|| option.startsWith(includeUserPathOptionWindows)
|| option.startsWith("-flto")) {
// Optimization and run-time flags.
continue;
}

Some files were not shown because too many files have changed in this diff Show More