Merge "Merge remote-tracking branch 'origin/11.0' into work"

This commit is contained in:
The Qt Project
2023-06-26 11:25:55 +00:00
27 changed files with 137 additions and 85 deletions

View File

@@ -118,7 +118,7 @@ Editing
* Fixed that generated functions did not have a `const` qualifier when * Fixed that generated functions did not have a `const` qualifier when
required required
([QTCREATORBUG-29274](https://bugreports.qt.io/browse/QTCREATORBUG-29274)) ([QTCREATORBUG-29274](https://bugreports.qt.io/browse/QTCREATORBUG-29274))
* Fixed that locator showed both the declaration and the definition of symbols * Fixed that the locator showed both the declaration and the definition of symbols
([QTCREATORBUG-13894](https://bugreports.qt.io/browse/QTCREATORBUG-13894)) ([QTCREATORBUG-13894](https://bugreports.qt.io/browse/QTCREATORBUG-13894))
* Fixed the handling of C++20 keywords and concepts * Fixed the handling of C++20 keywords and concepts
* Clangd * Clangd
@@ -154,8 +154,9 @@ Editing
### Python ### Python
* Added the option to create a virtual environment (`venv`) to the Python * Added the `Create Virtual Environment` option to the Python interpreter
interpreter selector and the wizard selector on the editor toolbar and to the wizards in `File > New Project >
> Application (Qt for Python)`
([PYSIDE-2152](https://bugreports.qt.io/browse/PYSIDE-2152)) ([PYSIDE-2152](https://bugreports.qt.io/browse/PYSIDE-2152))
* Fixed that too many progress indicators could be created * Fixed that too many progress indicators could be created
([QTCREATORBUG-29224](https://bugreports.qt.io/browse/QTCREATORBUG-29224)) ([QTCREATORBUG-29224](https://bugreports.qt.io/browse/QTCREATORBUG-29224))
@@ -167,10 +168,11 @@ Projects
* Made it possible to add devices in `Preferences > Devices > Add` without going * Made it possible to add devices in `Preferences > Devices > Add` without going
through the wizard through the wizard
([Documentation](https://doc.qt.io/qtcreator/creator-developing-b2qt.html))
([Documentation](https://doc.qt.io/qtcreator/creator-developing-generic-linux.html))
* Added support for moving files to a different directory when renaming them in * Added support for moving files to a different directory when renaming them in
the `File System` view the `File System` view
([QTCREATORBUG-15981](https://bugreports.qt.io/browse/QTCREATORBUG-15981)) ([QTCREATORBUG-15981](https://bugreports.qt.io/browse/QTCREATORBUG-15981))
([Documentation](https://doc.qt.io/qtcreator/creator-file-system-view.html)) ([Documentation](https://doc.qt.io/qtcreator/creator-file-system-view.html))
### CMake ### CMake
@@ -184,10 +186,13 @@ Projects
[QTCREATORBUG-28904](https://bugreports.qt.io/browse/QTCREATORBUG-28904), [QTCREATORBUG-28904](https://bugreports.qt.io/browse/QTCREATORBUG-28904),
[QTCREATORBUG-28985](https://bugreports.qt.io/browse/QTCREATORBUG-28985), [QTCREATORBUG-28985](https://bugreports.qt.io/browse/QTCREATORBUG-28985),
[QTCREATORBUG-29006](https://bugreports.qt.io/browse/QTCREATORBUG-29006)) [QTCREATORBUG-29006](https://bugreports.qt.io/browse/QTCREATORBUG-29006))
([Documentation](https://doc.qt.io/qtcreator/creator-project-cmake.html))
* Added `Build > Reload CMake Presets` to reload CMake presets after making * Added `Build > Reload CMake Presets` to reload CMake presets after making
changes to them changes to them
* Added support for `block()` and `endblock()` ([Documentation](https://doc-snapshots.qt.io/qtcreator-11.0/creator-build-settings-cmake-presets.html))
* Fixed that CMake Presets were not visible in `Projects` view * Added support for the `block()` and `endblock()` CMake commands
([CMake documentation](https://cmake.org/cmake/help/latest/command/block.html#command:block))
* Fixed that CMake Presets were not visible in the `Projects` view
([QTCREATORBUG-28966](https://bugreports.qt.io/browse/QTCREATORBUG-28966)) ([QTCREATORBUG-28966](https://bugreports.qt.io/browse/QTCREATORBUG-28966))
* Fixed issues with detecting a configured Qt version when importing a build * Fixed issues with detecting a configured Qt version when importing a build
([QTCREATORBUG-29075](https://bugreports.qt.io/browse/QTCREATORBUG-29075)) ([QTCREATORBUG-29075](https://bugreports.qt.io/browse/QTCREATORBUG-29075))
@@ -196,6 +201,7 @@ Projects
* Added an option for selecting the interpreter to the wizards in * Added an option for selecting the interpreter to the wizards in
`File > New Project > Application (Qt for Python)` `File > New Project > Application (Qt for Python)`
([Documentation](https://doc.qt.io/qtcreator/creator-project-creating.html))
Debugging Debugging
--------- ---------
@@ -203,6 +209,7 @@ Debugging
* Improved the UI for enabling and disabling debuggers in `Projects > Run > * Improved the UI for enabling and disabling debuggers in `Projects > Run >
Debugger settings` Debugger settings`
([QTCREATORBUG-28627](https://bugreports.qt.io/browse/QTCREATORBUG-28627)) ([QTCREATORBUG-28627](https://bugreports.qt.io/browse/QTCREATORBUG-28627))
([Documentation](https://doc.qt.io/qtcreator/creator-debugging-qml.html))
* Fixed the automatic source mapping for Qt versions from an installer * Fixed the automatic source mapping for Qt versions from an installer
([QTCREATORBUG-28950](https://bugreports.qt.io/browse/QTCREATORBUG-28950)) ([QTCREATORBUG-28950](https://bugreports.qt.io/browse/QTCREATORBUG-28950))
* Fixed pretty printer for `std::string` for recent `libc++` * Fixed pretty printer for `std::string` for recent `libc++`
@@ -210,8 +217,8 @@ Debugging
### C++ ### C++
* Added an option for the default number of array elements to show * Added the `Default array size` option for setting the default number of array
(`Preferences > Debugger > Locals & Expressions > Default array size`) elements to show in `Preferences > Debugger > Locals & Expressions`
* Fixed debugging in a terminal as the root user * Fixed debugging in a terminal as the root user
([QTCREATORBUG-27519](https://bugreports.qt.io/browse/QTCREATORBUG-27519)) ([QTCREATORBUG-27519](https://bugreports.qt.io/browse/QTCREATORBUG-27519))
* CDB * CDB
@@ -225,11 +232,12 @@ Debugging
### Qt Quick ### Qt Quick
* Improved the auto-detection if QML debugging is required * Improved the auto-detection of whether QML debugging is required
([QTCREATORBUG-28627](https://bugreports.qt.io/browse/QTCREATORBUG-28627)) ([QTCREATORBUG-28627](https://bugreports.qt.io/browse/QTCREATORBUG-28627))
* Added an option for disabling static analyzer messages to * Added the `Use customized static analyzer` option for disabling static analyzer
`Qt Quick > QML/JS Editing` messages to `Preferences > Qt Quick > QML/JS Editing`
([QTCREATORBUG-29095](https://bugreports.qt.io/browse/QTCREATORBUG-29095)) ([QTCREATORBUG-29095](https://bugreports.qt.io/browse/QTCREATORBUG-29095))
([Documentation](https://doc.qt.io/qtcreator/creator-checking-code-syntax.html))
Analyzer Analyzer
-------- --------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -842,6 +842,11 @@
extensions. It uses this deeper understanding to present objects of such extensions. It uses this deeper understanding to present objects of such
classes in a useful way. classes in a useful way.
To change the number of array elements that are
requested when expanding entries, select \uicontrol Edit >
\uicontrol Preferences > \uicontrol {Debugger} >
\uicontrol {Locals & Expressions} > \uicontrol {Default array size}.
\section1 Stepping Through Code \section1 Stepping Through Code
The following table summarizes the functions that you can use to step through The following table summarizes the functions that you can use to step through
@@ -984,7 +989,7 @@
> \uicontrol {Debugger} > \uicontrol {Locals & Expressions} > > \uicontrol {Debugger} > \uicontrol {Locals & Expressions} >
\uicontrol {Use Debugging Helpers}. \uicontrol {Use Debugging Helpers}.
\image qtcreator-debugging-helper-options.png "Locals & Expressions preferences" \image qtcreator-debugging-helper-options.webp {Locals & Expressions preferences}
In the \uicontrol Locals view, expand the object's entry and open the slot In the \uicontrol Locals view, expand the object's entry and open the slot
in the \e slots subitem. The view shows the objects connected to this slot in the \e slots subitem. The view shows the objects connected to this slot
@@ -1365,7 +1370,7 @@
\uicontrol Debugger > \uicontrol GDB > \uicontrol {Load system GDB pretty \uicontrol Debugger > \uicontrol GDB > \uicontrol {Load system GDB pretty
printers}. For more information, see \l{Specifying GDB Settings}. printers}. For more information, see \l{Specifying GDB Settings}.
\image qtcreator-gdb-options.png "GDB preferences" \image qtcreator-gdb-options.png {GDB preferences}
\section2 Customizing Built-In Debugging Helpers \section2 Customizing Built-In Debugging Helpers
@@ -1375,7 +1380,7 @@
\uicontrol Debugger > \uicontrol {Locals & Expressions}, and enter the \uicontrol Debugger > \uicontrol {Locals & Expressions}, and enter the
commands in the \uicontrol {Debugging Helper Customization} field. commands in the \uicontrol {Debugging Helper Customization} field.
\image qtcreator-debugging-helper-options.png "Locals & Expressions preferences" \image qtcreator-debugging-helper-options.webp {Locals & Expressions preferences}
If you receive error messages about receiving signals when using GDB, you If you receive error messages about receiving signals when using GDB, you
can specify \l{https://sourceware.org/gdb/onlinedocs/gdb/Signals.html} can specify \l{https://sourceware.org/gdb/onlinedocs/gdb/Signals.html}
@@ -1586,7 +1591,7 @@
selecting \uicontrol Edit > \uicontrol Preferences > \uicontrol Debugger > selecting \uicontrol Edit > \uicontrol Preferences > \uicontrol Debugger >
\uicontrol CDB > \uicontrol {Use Python dumper}. \uicontrol CDB > \uicontrol {Use Python dumper}.
\image qtcreator-cdb-options.png "CDB preferences" \image qtcreator-cdb-options.png {CDB preferences}
The following sections describe some of the widely-used Dumper classes and The following sections describe some of the widely-used Dumper classes and
members specified in \c qtcreator\share\qtcreator\debugger\dumper.py. members specified in \c qtcreator\share\qtcreator\debugger\dumper.py.
@@ -2036,7 +2041,7 @@
> \uicontrol Preferences > \uicontrol Debugger > \uicontrol GDB > > \uicontrol Preferences > \uicontrol Debugger > \uicontrol GDB >
\uicontrol {Use automatic symbol cache}. \uicontrol {Use automatic symbol cache}.
\image qtcreator-gdb-options.png "GDB preferences" \image qtcreator-gdb-options.png {GDB preferences}
\section2 Minimizing Number of Breakpoints \section2 Minimizing Number of Breakpoints

View File

@@ -16,15 +16,14 @@
While Linux, \macos, and Windows hosts are supported in principle, Linux is While Linux, \macos, and Windows hosts are supported in principle, Linux is
the recommended platform. the recommended platform.
Currently, only CMake is supported for building applications in the Docker
container.
To build, run, and debug applications on Docker devices, you must install and To build, run, and debug applications on Docker devices, you must install and
configure \c docker-cli on the development host. \QC automatically detects configure \c docker-cli on the development host. \QC automatically detects
\l{Adding Kits}{build and run kit} items, such \l{Adding Debuggers} \l{Adding Kits}{build and run kit} items, such \l{Adding Debuggers}
{debuggers} and \l{Adding Qt Versions}{Qt versions}, in the Docker container {debuggers} and \l{Adding Qt Versions}{Qt versions}, in the Docker container
and creates kits for the devices. and creates kits for the devices.
You can use CMake or qmake to build applications in the Docker container.
To pull images from Docker hub or other registries, use the To pull images from Docker hub or other registries, use the
\l{https://docs.docker.com/engine/reference/commandline/pull/}{docker pull} \l{https://docs.docker.com/engine/reference/commandline/pull/}{docker pull}
command. command.

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 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*! /*!
@@ -699,6 +699,19 @@
\endtable \endtable
\section1 Enabling and Disabling Messages
To enable and disable QML and JavaScript messages, select \uicontrol Edit >
\uicontrol Preferences > \uicontrol {Qt Quick} > \uicontrol {QML/JS Editing}
> \uicontrol {Use customized static analyzer}.
\image qtcreator-preferences-qtquick-qmljs-editing.webp {QML/JS Editing tab in Qt Quick preferences}
In \uicontrol Enabled, select the messages that you want to see.
To disable messages for non-Qt Quick UI files, select them in
\uicontrol {Disable messages for non Qt Quick UI}. You cannot
enable messages just for non-Qt Quick UI files.
\section1 Resetting the Code Model \section1 Resetting the Code Model
If you change the build and run kit when you have QML files open in the code If you change the build and run kit when you have QML files open in the code

View File

@@ -70,14 +70,14 @@
\li When developing on Linux, the \key {Ctrl+Shift+U} keyboard shortcut \li When developing on Linux, the \key {Ctrl+Shift+U} keyboard shortcut
might not work because it conflicts with a shortcut of the might not work because it conflicts with a shortcut of the
Intelligent Input Bus (ibus). You can change the shortcut for finding Intelligent Input Bus (ibus). You can change either the shortcut in
references to the symbol under the cursor either in \QC or in ibus. \QC or the conflicting shortcut in ibus.
To set another \l {Keyboard Shortcuts}{keyboard shortcut} To set another \l {Keyboard Shortcuts}{keyboard shortcut}
in \QC, select \uicontrol Edit > \uicontrol Preferences > in \QC, select \uicontrol Edit > \uicontrol Preferences >
\uicontrol Environment > \uicontrol Keyboard. \uicontrol Environment > \uicontrol Keyboard.
To change the shortcut in ibus, enter the following command on the To change the ibus shortcut, enter the following command on the
command line to start ibus setup: command line to start ibus setup:
\badcode \badcode
ibus-setup ibus-setup

View File

@@ -26,8 +26,8 @@
\image studio-live-preview.png \image studio-live-preview.png
\endif \endif
To preview any QML file that belongs to the project, right-click the project To preview any QML file that belongs to the project, right-click the
name in the \l Projects view, and select \uicontrol {Preview File}. filename in the \l Projects view, and select \uicontrol {Preview File}.
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
To preview the whole UI, select \uicontrol {Show Live Preview} To preview the whole UI, select \uicontrol {Show Live Preview}

View File

@@ -755,15 +755,15 @@ class Dumper(DumperBase):
qtVersionAndNamespace = None qtVersionAndNamespace = None
try: try:
qtVersionAndNamespace = self.fetchQtVersionAndNamespace() qtVersionAndNamespace = self.fetchQtVersionAndNamespace()
DumperBase.warn("Detected Qt Version: 0x%0x (namespace='%s')" % self.report("Detected Qt Version: 0x%0x (namespace='%s')" %
(qtVersionAndNamespace[1], qtVersionAndNamespace[0] or "no namespace")) (qtVersionAndNamespace[1], qtVersionAndNamespace[0] or "no namespace"))
except Exception as e: except Exception as e:
DumperBase.warn('[lldb] Error detecting Qt version: %s' % e) DumperBase.warn('[lldb] Error detecting Qt version: %s' % e)
try: try:
self.fetchInternalFunctions() self.fetchInternalFunctions()
DumperBase.warn('Found function QObject::property: 0x%0x' % self.qtPropertyFunc) self.report('Found function QObject::property: 0x%0x' % self.qtPropertyFunc)
DumperBase.warn('Found function QObject::customEvent: 0x%0x' % self.qtCustomEventFunc) self.report('Found function QObject::customEvent: 0x%0x' % self.qtCustomEventFunc)
except Exception as e: except Exception as e:
DumperBase.warn('[lldb] Error fetching internal Qt functions: %s' % e) DumperBase.warn('[lldb] Error fetching internal Qt functions: %s' % e)

View File

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

View File

@@ -263,15 +263,17 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
if (target->buildConfigurations().first()->buildType() != BuildConfiguration::BuildType::Release) if (target->buildConfigurations().first()->buildType() != BuildConfiguration::BuildType::Release)
m_extraAppParams = runControl->commandLine().arguments(); m_extraAppParams = runControl->commandLine().arguments();
if (auto aspect = runControl->aspect(Constants::ANDROID_AM_START_ARGS)) { if (const QVariantMap sd = runControl->settingsData(Constants::ANDROID_AM_START_ARGS);
QTC_CHECK(aspect->value.typeId() == QVariant::String); !sd.values().isEmpty()) {
const QString startArgs = aspect->value.toString(); QTC_CHECK(sd.first().type() == QVariant::String);
const QString startArgs = sd.first().toString();
m_amStartExtraArgs = ProcessArgs::splitArgs(startArgs, OsTypeOtherUnix); m_amStartExtraArgs = ProcessArgs::splitArgs(startArgs, OsTypeOtherUnix);
} }
if (auto aspect = runControl->aspect(Constants::ANDROID_PRESTARTSHELLCMDLIST)) { if (const QVariantMap sd = runControl->settingsData(Constants::ANDROID_PRESTARTSHELLCMDLIST);
QTC_CHECK(aspect->value.typeId() == QVariant::String); !sd.values().isEmpty()) {
const QStringList commands = aspect->value.toString().split('\n', Qt::SkipEmptyParts); QTC_CHECK(sd.first().type() == QVariant::String);
const QStringList commands = sd.first().toString().split('\n', Qt::SkipEmptyParts);
for (const QString &shellCmd : commands) for (const QString &shellCmd : commands)
m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd)); m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd));
} }
@@ -279,9 +281,10 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
for (const QString &shellCmd : preStartCmdList.toStringList()) for (const QString &shellCmd : preStartCmdList.toStringList())
m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd)); m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd));
if (auto aspect = runControl->aspect(Constants::ANDROID_POSTFINISHSHELLCMDLIST)) { if (const QVariantMap sd = runControl->settingsData(Constants::ANDROID_POSTFINISHSHELLCMDLIST);
QTC_CHECK(aspect->value.typeId() == QVariant::String); !sd.values().isEmpty()) {
const QStringList commands = aspect->value.toString().split('\n', Qt::SkipEmptyParts); QTC_CHECK(sd.first().type() == QVariant::String);
const QStringList commands = sd.first().toString().split('\n', Qt::SkipEmptyParts);
for (const QString &shellCmd : commands) for (const QString &shellCmd : commands)
m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd)); m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd));
} }

View File

@@ -57,9 +57,10 @@ FilePath ITestConfiguration::executableFilePath() const
if (!hasExecutable()) if (!hasExecutable())
return {}; return {};
const Environment env = m_runnable.environment.hasChanges() const Environment env = m_runnable.environment.appliedToEnvironment(
? m_runnable.environment : Environment::systemEnvironment(); m_runnable.command.executable().deviceEnvironment());
return env.searchInPath(m_runnable.command.executable().path());
return m_runnable.command.executable().searchInDirectories(env.path());
} }
Environment ITestConfiguration::filteredEnvironment(const Environment &original) const Environment ITestConfiguration::filteredEnvironment(const Environment &original) const

View File

@@ -350,8 +350,8 @@ static RunSettings runSettings()
return ClangToolsSettings::instance()->runSettings(); return ClangToolsSettings::instance()->runSettings();
} }
ClangTool::ClangTool(const QString &name, Utils::Id id) ClangTool::ClangTool(const QString &name, Utils::Id id, ClangToolType type)
: m_name(name), m_perspective{id.toString(), name} : m_name(name), m_perspective{id.toString(), name}, m_type(type)
{ {
setObjectName(name); setObjectName(name);
m_diagnosticModel = new ClangToolsDiagnosticModel(this); m_diagnosticModel = new ClangToolsDiagnosticModel(this);
@@ -830,8 +830,7 @@ static bool canAnalyzeProject(Project *project)
struct CheckResult { struct CheckResult {
enum { enum {
InvalidTidyExecutable, InvalidExecutable,
InvalidClazyExecutable,
ProjectNotOpen, ProjectNotOpen,
ProjectNotSuitable, ProjectNotSuitable,
ReadyToAnalyze, ReadyToAnalyze,
@@ -839,20 +838,13 @@ struct CheckResult {
QString errorText; QString errorText;
}; };
static CheckResult canAnalyze() static CheckResult canAnalyze(ClangToolType type, const QString &name)
{ {
const ClangDiagnosticConfig config = diagnosticConfig(runSettings().diagnosticConfigId()); const ClangDiagnosticConfig config = diagnosticConfig(runSettings().diagnosticConfigId());
if (toolEnabled(ClangToolType::Tidy, config, runSettings()) if (toolEnabled(type, config, runSettings())
&& !toolExecutable(ClangToolType::Tidy).isExecutableFile()) { && !toolExecutable(type).isExecutableFile()) {
return {CheckResult::InvalidTidyExecutable, return {CheckResult::InvalidExecutable, Tr::tr("Set a valid %1 executable.").arg(name)};
Tr::tr("Set a valid Clang-Tidy executable.")};
}
if (toolEnabled(ClangToolType::Clazy, config, runSettings())
&& !toolExecutable(ClangToolType::Clazy).isExecutableFile()) {
return {CheckResult::InvalidClazyExecutable,
Tr::tr("Set a valid Clazy-Standalone executable.")};
} }
if (Project *project = ProjectManager::startupProject()) { if (Project *project = ProjectManager::startupProject()) {
@@ -876,10 +868,9 @@ void ClangTool::updateForInitialState()
m_infoBarWidget->reset(); m_infoBarWidget->reset();
const CheckResult result = canAnalyze(); const CheckResult result = canAnalyze(m_type, m_name);
switch (result.kind) switch (result.kind)
case CheckResult::InvalidTidyExecutable: { case CheckResult::InvalidExecutable: {
case CheckResult::InvalidClazyExecutable:
m_infoBarWidget->setError(InfoBarWidget::Warning, makeLink(result.errorText), m_infoBarWidget->setError(InfoBarWidget::Warning, makeLink(result.errorText),
[] { ICore::showOptionsDialog(Constants::SETTINGS_PAGE_ID); }); [] { ICore::showOptionsDialog(Constants::SETTINGS_PAGE_ID); });
break; break;
@@ -1084,7 +1075,7 @@ void ClangTool::updateForCurrentState()
QString startActionToolTip = m_startAction->text(); QString startActionToolTip = m_startAction->text();
QString startOnCurrentToolTip = m_startOnCurrentFileAction->text(); QString startOnCurrentToolTip = m_startOnCurrentFileAction->text();
if (!isRunning) { if (!isRunning) {
const CheckResult result = canAnalyze(); const CheckResult result = canAnalyze(m_type, m_name);
canStart = result.kind == CheckResult::ReadyToAnalyze; canStart = result.kind == CheckResult::ReadyToAnalyze;
if (!canStart) { if (!canStart) {
startActionToolTip = result.errorText; startActionToolTip = result.errorText;
@@ -1171,11 +1162,12 @@ void ClangTool::updateForCurrentState()
m_infoBarWidget->setDiagText(diagText); m_infoBarWidget->setDiagText(diagText);
} }
ClangTidyTool::ClangTidyTool() : ClangTool(Tr::tr("Clang-Tidy"), "ClangTidy.Perspective") ClangTidyTool::ClangTidyTool() : ClangTool(Tr::tr("Clang-Tidy"), "ClangTidy.Perspective",
ClangToolType::Tidy)
{ {
m_instance = this; m_instance = this;
} }
ClazyTool::ClazyTool() : ClangTool(Tr::tr("Clazy"), "Clazy.Perspective") ClazyTool::ClazyTool() : ClangTool(Tr::tr("Clazy"), "Clazy.Perspective", ClangToolType::Clazy)
{ {
m_instance = this; m_instance = this;
} }

View File

@@ -82,7 +82,7 @@ signals:
void finished(const QString &errorText); // For testing. void finished(const QString &errorText); // For testing.
protected: protected:
ClangTool(const QString &name, Utils::Id id); ClangTool(const QString &name, Utils::Id id, CppEditor::ClangToolType type);
private: private:
enum class State { enum class State {
@@ -154,6 +154,7 @@ private:
QAction *m_expandCollapse = nullptr; QAction *m_expandCollapse = nullptr;
Utils::Perspective m_perspective; Utils::Perspective m_perspective;
const CppEditor::ClangToolType m_type;
}; };
class ClangTidyTool : public ClangTool class ClangTidyTool : public ClangTool

View File

@@ -218,11 +218,11 @@ GroupItem clangToolTask(const AnalyzeInputData &input,
}; };
const Group group { const Group group {
finishAllAndDone,
Storage(storage), Storage(storage),
onGroupSetup(onSetup), onGroupSetup(onSetup),
Group { Group {
sequential, sequential,
finishAllAndDone,
ProcessTask(onProcessSetup, onProcessDone, onProcessError), ProcessTask(onProcessSetup, onProcessDone, onProcessError),
AsyncTask<expected_str<Diagnostics>>(onReadSetup, onReadDone, onReadError) AsyncTask<expected_str<Diagnostics>>(onReadSetup, onReadDone, onReadError)
} }

View File

@@ -15,6 +15,7 @@
#include <QAction> #include <QAction>
using namespace TextEditor; using namespace TextEditor;
using namespace Utils;
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -22,37 +23,35 @@ namespace Internal {
DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic, TextDocument *document) DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic, TextDocument *document)
: TextMark(document, : TextMark(document,
diagnostic.location.line, diagnostic.location.line,
{Tr::tr("Clang Tools"), Utils::Id(Constants::DIAGNOSTIC_MARK_ID)}) {Tr::tr("Clang Tools"), Id(Constants::DIAGNOSTIC_MARK_ID)})
, m_diagnostic(diagnostic) , m_diagnostic(diagnostic)
{ {
setSettingsPage(Constants::SETTINGS_PAGE_ID); setSettingsPage(Constants::SETTINGS_PAGE_ID);
if (diagnostic.type == "error" || diagnostic.type == "fatal") const bool isError = diagnostic.type == "error" || diagnostic.type == "fatal";
setColor(Utils::Theme::CodeModel_Error_TextMarkColor); setColor(isError ? Theme::CodeModel_Error_TextMarkColor : Theme::CodeModel_Warning_TextMarkColor);
else setPriority(isError ? TextEditor::TextMark::HighPriority : TextEditor::TextMark::NormalPriority);
setColor(Utils::Theme::CodeModel_Warning_TextMarkColor);
setPriority(TextEditor::TextMark::HighPriority);
QIcon markIcon = diagnostic.icon(); QIcon markIcon = diagnostic.icon();
setIcon(markIcon.isNull() ? Utils::Icons::CODEMODEL_WARNING.icon() : markIcon); setIcon(markIcon.isNull() ? Icons::CODEMODEL_WARNING.icon() : markIcon);
setToolTip(createDiagnosticToolTipString(diagnostic, std::nullopt, true)); setToolTip(createDiagnosticToolTipString(diagnostic, std::nullopt, true));
setLineAnnotation(diagnostic.description); setLineAnnotation(diagnostic.description);
setActionsProvider([diagnostic] { setActionsProvider([diagnostic] {
// Copy to clipboard action // Copy to clipboard action
QList<QAction *> actions; QList<QAction *> actions;
QAction *action = new QAction(); QAction *action = new QAction();
action->setIcon(QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon())); action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
action->setToolTip(Tr::tr("Copy to Clipboard")); action->setToolTip(Tr::tr("Copy to Clipboard"));
QObject::connect(action, &QAction::triggered, [diagnostic] { QObject::connect(action, &QAction::triggered, [diagnostic] {
const QString text = createFullLocationString(diagnostic.location) const QString text = createFullLocationString(diagnostic.location)
+ ": " + ": "
+ diagnostic.description; + diagnostic.description;
Utils::setClipboardAndSelection(text); setClipboardAndSelection(text);
}); });
actions << action; actions << action;
// Disable diagnostic action // Disable diagnostic action
action = new QAction(); action = new QAction();
action->setIcon(Utils::Icons::BROKEN.icon()); action->setIcon(Icons::BROKEN.icon());
action->setToolTip(Tr::tr("Disable Diagnostic")); action->setToolTip(Tr::tr("Disable Diagnostic"));
QObject::connect(action, &QAction::triggered, [diagnostic] { disableChecks({diagnostic}); }); QObject::connect(action, &QAction::triggered, [diagnostic] { disableChecks({diagnostic}); });
actions << action; actions << action;
@@ -70,10 +69,10 @@ void DiagnosticMark::disable()
return; return;
m_enabled = false; m_enabled = false;
if (m_diagnostic.type == "error" || m_diagnostic.type == "fatal") if (m_diagnostic.type == "error" || m_diagnostic.type == "fatal")
setIcon(Utils::Icons::CODEMODEL_DISABLED_ERROR.icon()); setIcon(Icons::CODEMODEL_DISABLED_ERROR.icon());
else else
setIcon(Utils::Icons::CODEMODEL_DISABLED_WARNING.icon()); setIcon(Icons::CODEMODEL_DISABLED_WARNING.icon());
setColor(Utils::Theme::Color::IconsDisabledColor); setColor(Theme::Color::IconsDisabledColor);
} }
bool DiagnosticMark::enabled() const bool DiagnosticMark::enabled() const

View File

@@ -27,9 +27,22 @@ public:
{ {
using namespace Layouting; using namespace Layouting;
auto warningLabel = new QLabel;
warningLabel->setWordWrap(true);
warningLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse
| Qt::LinksAccessibleByKeyboard
| Qt::TextSelectableByMouse);
warningLabel->setText(Tr::tr(
"Enabling %1 is subject to your agreement and abidance with your applicable "
"%1 terms. It is your responsibility to know and accept the requirements and "
"parameters of using tools like %1. This may include, but is not limited to, "
"ensuring you have the rights to allow %1 access to your code, as well as "
"understanding any implications of your use of %1 and suggestions produced "
"(like copyright, accuracy, etc.)." ).arg("Copilot"));
auto authWidget = new AuthWidget(); auto authWidget = new AuthWidget();
QLabel *helpLabel = new QLabel(); auto helpLabel = new QLabel();
helpLabel->setTextFormat(Qt::MarkdownText); helpLabel->setTextFormat(Qt::MarkdownText);
helpLabel->setWordWrap(true); helpLabel->setWordWrap(true);
helpLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse helpLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse
@@ -52,8 +65,10 @@ public:
.arg("[agent.js](https://github.com/github/copilot.vim/tree/release/copilot/dist)")); .arg("[agent.js](https://github.com/github/copilot.vim/tree/release/copilot/dist)"));
Column { Column {
authWidget, br, QString("<b>" + Tr::tr("Note:") + "</b>"), br,
warningLabel, br,
CopilotSettings::instance().enableCopilot, br, CopilotSettings::instance().enableCopilot, br,
authWidget, br,
CopilotSettings::instance().nodeJsPath, br, CopilotSettings::instance().nodeJsPath, br,
CopilotSettings::instance().distPath, br, CopilotSettings::instance().distPath, br,
CopilotSettings::instance().autoComplete, br, CopilotSettings::instance().autoComplete, br,

View File

@@ -20,7 +20,7 @@ static void initEnableAspect(BoolAspect &enableCopilot)
enableCopilot.setDisplayName(Tr::tr("Enable Copilot")); enableCopilot.setDisplayName(Tr::tr("Enable Copilot"));
enableCopilot.setLabelText(Tr::tr("Enable Copilot")); enableCopilot.setLabelText(Tr::tr("Enable Copilot"));
enableCopilot.setToolTip(Tr::tr("Enables the Copilot integration.")); enableCopilot.setToolTip(Tr::tr("Enables the Copilot integration."));
enableCopilot.setDefaultValue(true); enableCopilot.setDefaultValue(false);
} }
CopilotSettings &CopilotSettings::instance() CopilotSettings &CopilotSettings::instance()
@@ -52,6 +52,7 @@ CopilotSettings::CopilotSettings()
nodeJsPath.setLabelText(Tr::tr("Node.js path:")); nodeJsPath.setLabelText(Tr::tr("Node.js path:"));
nodeJsPath.setHistoryCompleter("Copilot.NodePath.History"); nodeJsPath.setHistoryCompleter("Copilot.NodePath.History");
nodeJsPath.setDisplayName(Tr::tr("Node.js Path")); nodeJsPath.setDisplayName(Tr::tr("Node.js Path"));
nodeJsPath.setEnabler(&enableCopilot);
nodeJsPath.setToolTip( nodeJsPath.setToolTip(
Tr::tr("Select path to node.js executable. See https://nodejs.org/en/download/" Tr::tr("Select path to node.js executable. See https://nodejs.org/en/download/"
"for installation instructions.")); "for installation instructions."));
@@ -62,6 +63,7 @@ CopilotSettings::CopilotSettings()
distPath.setLabelText(Tr::tr("Path to agent.js:")); distPath.setLabelText(Tr::tr("Path to agent.js:"));
distPath.setHistoryCompleter("Copilot.DistPath.History"); distPath.setHistoryCompleter("Copilot.DistPath.History");
distPath.setDisplayName(Tr::tr("Agent.js path")); distPath.setDisplayName(Tr::tr("Agent.js path"));
distPath.setEnabler(&enableCopilot);
distPath.setToolTip(Tr::tr( distPath.setToolTip(Tr::tr(
"Select path to agent.js in Copilot Neovim plugin. See " "Select path to agent.js in Copilot Neovim plugin. See "
"https://github.com/github/copilot.vim#getting-started for installation instructions.")); "https://github.com/github/copilot.vim#getting-started for installation instructions."));
@@ -70,6 +72,7 @@ CopilotSettings::CopilotSettings()
autoComplete.setSettingsKey("Copilot.Autocomplete"); autoComplete.setSettingsKey("Copilot.Autocomplete");
autoComplete.setLabelText(Tr::tr("Request completions automatically")); autoComplete.setLabelText(Tr::tr("Request completions automatically"));
autoComplete.setDefaultValue(true); autoComplete.setDefaultValue(true);
autoComplete.setEnabler(&enableCopilot);
autoComplete.setToolTip(Tr::tr("Automatically request suggestions for the current text cursor " autoComplete.setToolTip(Tr::tr("Automatically request suggestions for the current text cursor "
"position after changes to the document.")); "position after changes to the document."));

View File

@@ -61,7 +61,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor,
const QString &text = block.text(); const QString &text = block.text();
const Tokens &tks = lexer(text); const Tokens &tks = lexer(text);
for (const Token &tk : tks) { for (const Token &tk : tks) {
if (tk.is(T_SEMICOLON) || tk.is(T_LBRACE)) { if (tk.is(T_SEMICOLON)) {
// No need to continue beyond this, we might already have something meaningful. // No need to continue beyond this, we might already have something meaningful.
cursor.setPosition(block.position() + tk.utf16charsEnd(), QTextCursor::KeepAnchor); cursor.setPosition(block.position() + tk.utf16charsEnd(), QTextCursor::KeepAnchor);
break; break;
@@ -74,6 +74,11 @@ QString DoxygenGenerator::generate(QTextCursor cursor,
block = block.next(); block = block.next();
} }
// For the edge case of no semicolons at all, which can e.g. happen if the file
// consists only of empty function definitions.
if (!cursor.hasSelection())
cursor.setPosition(cursor.document()->characterCount() - 1, QTextCursor::KeepAnchor);
if (!cursor.hasSelection()) if (!cursor.hasSelection())
return QString(); return QString();

View File

@@ -13,6 +13,7 @@ QtcPlugin {
Depends { name: "ProjectExplorer" } Depends { name: "ProjectExplorer" }
Depends { name: "Debugger" } Depends { name: "Debugger" }
Depends { name: "CMakeProjectManager" } Depends { name: "CMakeProjectManager" }
Depends { name: "QmlJS" }
Depends { name: "QtSupport" } Depends { name: "QtSupport" }
Depends { name: "qtc_gtest_gmock"; condition: qtc.testsEnabled; required: false } Depends { name: "qtc_gtest_gmock"; condition: qtc.testsEnabled; required: false }

View File

@@ -87,6 +87,9 @@ void MesonBuildSystem::parsingCompleted(bool success)
UNLOCK(false); UNLOCK(false);
emitBuildSystemUpdated(); emitBuildSystemUpdated();
} }
emitParsingFinished(success);
emit buildConfiguration()->enabledChanged(); // HACK. Should not be needed.
} }
ProjectExplorer::Kit *MesonBuildSystem::MesonBuildSystem::kit() ProjectExplorer::Kit *MesonBuildSystem::MesonBuildSystem::kit()

View File

@@ -1107,7 +1107,7 @@ static FilePaths findCompilerCandidates(const ToolchainDetector &detector,
FilePaths compilerPaths; FilePaths compilerPaths;
if (!device.isNull()) { if (device && device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
// FIXME: Merge with block below // FIXME: Merge with block below
FilePaths searchPaths = detector.searchPaths; FilePaths searchPaths = detector.searchPaths;
if (searchPaths.isEmpty()) if (searchPaths.isEmpty())

View File

@@ -138,6 +138,8 @@ void TextMark::paintAnnotation(QPainter &painter,
painter.fontMetrics(), painter.fontMetrics(),
fadeInOffset, fadeInOffset,
fadeOutOffset); fadeOutOffset);
if (m_staticAnnotationText.text() != rects.text)
m_staticAnnotationText.setText(rects.text);
annotationRect->setRight(rects.fadeOutRect.right()); annotationRect->setRight(rects.fadeOutRect.right());
const QRectF eventRectF(eventRect); const QRectF eventRectF(eventRect);
if (!(rects.fadeInRect.intersects(eventRectF) || rects.annotationRect.intersects(eventRectF) if (!(rects.fadeInRect.intersects(eventRectF) || rects.annotationRect.intersects(eventRectF)
@@ -161,7 +163,7 @@ void TextMark::paintAnnotation(QPainter &painter,
painter.fillRect(rects.annotationRect, colors.rectColor); painter.fillRect(rects.annotationRect, colors.rectColor);
painter.setPen(colors.textColor); painter.setPen(colors.textColor);
paintIcon(&painter, rects.iconRect.toAlignedRect()); paintIcon(&painter, rects.iconRect.toAlignedRect());
painter.drawText(rects.textRect, Qt::AlignLeft, rects.text); painter.drawStaticText(rects.textRect.topLeft(), m_staticAnnotationText);
if (rects.fadeOutRect.isValid()) { if (rects.fadeOutRect.isValid()) {
grad = QLinearGradient(rects.fadeOutRect.topLeft() - contentOffset, grad = QLinearGradient(rects.fadeOutRect.topLeft() - contentOffset,
rects.fadeOutRect.topRight() - contentOffset); rects.fadeOutRect.topRight() - contentOffset);

View File

@@ -11,6 +11,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QIcon> #include <QIcon>
#include <QStaticText>
#include <QVector> #include <QVector>
#include <optional> #include <optional>
@@ -139,6 +140,7 @@ private:
bool m_visible = false; bool m_visible = false;
TextMarkCategory m_category; TextMarkCategory m_category;
QString m_lineAnnotation; QString m_lineAnnotation;
mutable QStaticText m_staticAnnotationText;
QString m_toolTip; QString m_toolTip;
std::function<QString()> m_toolTipProvider; std::function<QString()> m_toolTipProvider;
QString m_defaultToolTip; QString m_defaultToolTip;