Merge remote-tracking branch 'origin/14.0'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs

Change-Id: I325f21db9bac247a02cb14452f190b378147f581
This commit is contained in:
Eike Ziller
2024-06-17 13:54:25 +02:00
38 changed files with 377 additions and 135 deletions

View File

@@ -51,9 +51,12 @@ Editing
([QTCREATORBUG-12190](https://bugreports.qt.io/browse/QTCREATORBUG-12190)) ([QTCREATORBUG-12190](https://bugreports.qt.io/browse/QTCREATORBUG-12190))
* Added `Re-order Member Function Definitions According to Declaration Order` * Added `Re-order Member Function Definitions According to Declaration Order`
([QTCREATORBUG-6199](https://bugreports.qt.io/browse/QTCREATORBUG-6199)) ([QTCREATORBUG-6199](https://bugreports.qt.io/browse/QTCREATORBUG-6199))
* Added triggers for `Add Curly Braces` * Added `Add Curly Braces` for do, while, and for loops
* Fixed issues with macros * Fixed issues with macros
([QTCREATORBUG-10279](https://bugreports.qt.io/browse/QTCREATORBUG-10279)) ([QTCREATORBUG-10279](https://bugreports.qt.io/browse/QTCREATORBUG-10279))
[Documentation](https://doc.qt.io/qtcreator/creator-reference-cpp-quick-fixes.html)
* Clangd * Clangd
* Increased the minimum version to LLVM 17 * Increased the minimum version to LLVM 17
* Added the `Per-project index location` and `Per-session index location` * Added the `Per-project index location` and `Per-session index location`
@@ -83,7 +86,8 @@ Editing
* Improved support for enums * Improved support for enums
([QTCREATORBUG-19226](https://bugreports.qt.io/browse/QTCREATORBUG-19226)) ([QTCREATORBUG-19226](https://bugreports.qt.io/browse/QTCREATORBUG-19226))
* Added `Qt Design Studio` to `Open With` for `.ui.qml`-files * Added `Qt Design Studio` to `Open With` for `.ui.qml` files
([Documentation](https://doc.qt.io/qtcreator/creator-quick-ui-forms.html))
* Language Server * Language Server
* Switched on by default * Switched on by default
* Added option for generating `qmlls.ini` files for CMake projects * Added option for generating `qmlls.ini` files for CMake projects
@@ -94,7 +98,8 @@ Editing
### Python ### Python
* Added the option to install Python LSP updates * Added options for updating Python Language Server
([Documentation] (https://doc-snapshots.qt.io/qtcreator-14.0/creator-language-servers.html))
### Language Server Protocol ### Language Server Protocol

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@@ -115,7 +115,7 @@
\row \row
\li Assign to Local Variable \li Assign to Local Variable
\li Adds a local variable which stores the return value of a \li Adds a local variable which stores the return value of a
function call or a new expression. For example, rewrites: function call or a new expression. For example, rewrites
\code \code
QString s; QString s;
@@ -195,7 +195,7 @@
\row \row
\li Move All Function Definitions \li Move All Function Definitions
\li Moves all function definitions to the implementation file or \li Moves all function definitions to the implementation file or
outside the class. For example, rewrites: outside the class. For example, rewrites
\code \code
class Foo class Foo
{ {
@@ -281,12 +281,14 @@
\li Description \li Description
\row \row
\li Add Curly Braces \li Add Curly Braces
\li Adds curly braces to an if statement that does not have a \li Adds curly braces to an if clause or to a do, while, or for
compound statement. For example, rewrites loop. For example, rewrites an if clause
\code \code
if (a) if (a)
b; b;
else
c;
\endcode \endcode
as as
@@ -294,6 +296,54 @@
\code \code
if (a) { if (a) {
b; b;
} else {
c;
}
\endcode
Rewrites a do loop
\code
do
++i;
while (i < 10);
\endcode
as
\code
do {
++i;
} while (i < 10);
\endcode
Rewrites a while loop
\code
while (i > 0)
--i;
\endcode
as
\code
while (i > 0) {
--i;
}
\endcode
Rewrites a for loop
\code
for (int i = 0; i < 10; ++i)
func(i);
\endcode
as
\code
for (int i = 0; i < 10; ++i) {
func(i);
} }
\endcode \endcode
\row \row
@@ -321,7 +371,7 @@
post-decrement operators as pre-decrement operators. It also post-decrement operators as pre-decrement operators. It also
moves other than string or numeric literals and id expressions moves other than string or numeric literals and id expressions
from the condition of a for loop to its initializer. For from the condition of a for loop to its initializer. For
example, rewrites: example, rewrites
\code \code
for (int i = 0; i < 3 * 2; i++) for (int i = 0; i < 3 * 2; i++)
@@ -411,15 +461,66 @@
\inlineimage icons/refactormarker.png \inlineimage icons/refactormarker.png
\row \row
\li Convert Function Call to Qt Meta-Method Invocation \li Convert Function Call to Qt Meta-Method Invocation
\li Converts a normal function call into a meta method invocation, if \li Converts an invokable function call into a meta method
the function is marked as invokable. invocation. This applies to signals and slots in general,
as well as functions explicitly marked with \c Q_INVOKABLE.
For example, for the following class:
\code
class Foo : public QObject
{
Q_OBJECT
public:
explicit Foo(QObject *parent = nullptr);
Q_SLOT void pubBar(int i);
private:
Q_INVOKABLE void bar(int i, const QString &c);
};
\endcode
rewrites
\code
Foo::Foo(QObject *parent)
: QObject{parent}
{
this->bar(42, QString("answer"));
}
\endcode
as
\code
Foo::Foo(QObject *parent)
: QObject{parent}
{
QMetaObject::invokeMethod(this, "bar", Q_ARG(int, 42), Q_ARG(QString, QString("answer")));
}
\endcode
The quick fix also works on invokable methods outside the class that are
visible from the location where they are called from. For example, it
rewrites
\code
Foo f;
f.pubBar(123);
\endcode
as
\code
Foo f;
QMetaObject::invokeMethod(&f, "pubBar", Q_ARG(int, 123));
\endcode
\row \row
\li Move Definition Here \li Move Definition Here
\li Moves an existing function definition to its declaration. \li Moves an existing function definition to its declaration.
\row \row
\li Move Function Definition \li Move Function Definition
\li Moves a function definition to the implementation file, outside \li Moves a function definition to the implementation file, outside
the class or back to its declaration. For example, rewrites: the class or back to its declaration. For example, rewrites
\code \code
class Foo class Foo
{ {
@@ -504,7 +605,7 @@
\row \row
\li Rewrite Condition Using || \li Rewrite Condition Using ||
\li Rewrites the expression according to De Morgan's laws. For \li Rewrites the expression according to De Morgan's laws. For
example, rewrites: example, rewrites
\code \code
!a && !b !a && !b
\endcode \endcode
@@ -518,7 +619,7 @@
\row \row
\li Rewrite Using \e operator \li Rewrite Using \e operator
\li Rewrites an expression negating it and using the inverse \li Rewrites an expression negating it and using the inverse
operator. For example, rewrites: operator. For example, rewrites
\list \list
@@ -558,7 +659,7 @@
\row \row
\li Split if Statement \li Split if Statement
\li Splits an if statement into several statements. For example, \li Splits an if statement into several statements. For example,
rewrites: rewrites
\code \code
if (something && something_else) { if (something && something_else) {
@@ -594,7 +695,7 @@
\row \row
\li Swap Operands \li Swap Operands
\li Rewrites an expression in the inverse order using the inverse \li Rewrites an expression in the inverse order using the inverse
operator. For example, rewrites: operator. For example, rewrites
\code \code
a op b a op b
\endcode \endcode
@@ -750,7 +851,7 @@
\row \row
\li Convert to Pointer \li Convert to Pointer
\li Converts the selected stack variable to a pointer. For example, \li Converts the selected stack variable to a pointer. For example,
rewrites: rewrites
\code \code
QByteArray foo = "foo"; QByteArray foo = "foo";
@@ -771,7 +872,7 @@
\row \row
\li Convert to Stack Variable \li Convert to Stack Variable
\li Converts the selected pointer to a stack variable. For example, \li Converts the selected pointer to a stack variable. For example,
rewrites: rewrites
\code \code
QByteArray *foo = new QByteArray("foo"); QByteArray *foo = new QByteArray("foo");
@@ -796,7 +897,7 @@
project is open, the current global code style settings are project is open, the current global code style settings are
used. used.
For example, rewrites: For example, rewrites
\code \code
char*s; char*s;
@@ -816,7 +917,7 @@
\row \row
\li Split Declaration \li Split Declaration
\li Splits a simple declaration into several declarations. For \li Splits a simple declaration into several declarations. For
example, rewrites: example, rewrites
\code \code
int *a, b; int *a, b;
\endcode \endcode

View File

@@ -36,6 +36,7 @@
\l{Outline} view or in the \uicontrol Symbols list on the \l{Outline} view or in the \uicontrol Symbols list on the
\l{Edit Mode}{editor toolbar} \l{Edit Mode}{editor toolbar}
\li \l{Call Hierarchy}{Viewing the callers and callees of a function} \li \l{Call Hierarchy}{Viewing the callers and callees of a function}
\li \l{Type Hierarchy}{Viewing the base classes and derived classes of a class}
\li \l{Find references to a symbol}{Finding references to symbols} \li \l{Find references to a symbol}{Finding references to symbols}
\li \l{Rename symbols}{Renaming the symbol under the cursor} \li \l{Rename symbols}{Renaming the symbol under the cursor}
\li Code actions \li Code actions
@@ -90,6 +91,19 @@
To remove language servers from the list, select \uicontrol Delete. To remove language servers from the list, select \uicontrol Delete.
\section1 Updating Python Language Server
\QC offers to update the Python language server when you open a Python
file in the editor.
\image qtcreator-python-update-language-server.webp {Message about updating Python Language Server}
To update the language server, select \uicontrol Update. To save your choice,
select \uicontrol {Always Update}.
To skip updating and hide the message for future updates, select
\uicontrol Never.
\section1 Supported Locator Filters \section1 Supported Locator Filters
The locator enables you to browse not only files, but any items defined by The locator enables you to browse not only files, but any items defined by

View File

@@ -23,14 +23,18 @@
\brief Limitations of \QDS UI files (.ui.qml). \brief Limitations of \QDS UI files (.ui.qml).
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
You can use \QDS wizards to create UI files that have the filename \QDS wizards create UI files that have the filename extension \e .ui.qml.
extension \e .ui.qml. The UI files can be edited in the \l {2D} view. Edit the UI files in the \l {2D} view.
If you use the \l {Code} view to add code that is not supported
by the \uicontrol {2D} view, \QDS displays error messages. If you use the \l {Code} view to add code that the \uicontrol {2D} view does
not support, \QDS displays error messages.
\else \else
If you switch between \QC and \QDS or cooperate with designers on If you switch between \QC and \QDS or cooperate with designers on
a project, you might encounter UI files (.ui.qml). They are intended to a project, you might encounter UI files (.ui.qml). They are intended to
be edited in \QDS only. be edited in \QDS only.
To open UI files with \QDS, select \uicontrol {Open With} >
\uicontrol {\QDS} in the context menu for the file.
\endif \endif

View File

@@ -1072,7 +1072,6 @@ class DumperBase():
def check_typeid(self, typeid): def check_typeid(self, typeid):
if not isinstance(typeid, int): if not isinstance(typeid, int):
size = self.type_size_cache.get(typeid, None)
raise RuntimeError('WRONG TYPE FOR TYPEID: %s %s' % (str(typeid), type(typeid))) raise RuntimeError('WRONG TYPE FOR TYPEID: %s %s' % (str(typeid), type(typeid)))
def checkRef(self, ref): def checkRef(self, ref):

View File

@@ -462,14 +462,17 @@ static bool isFileIncluded(const QList<QRegularExpression> &filterRegs,
return isIncluded && (exclusionRegs.isEmpty() || !matches(exclusionRegs, filePath)); return isIncluded && (exclusionRegs.isEmpty() || !matches(exclusionRegs, filePath));
} }
std::function<FilePaths(const FilePaths &)> filterFilesFunction(const QStringList &filters, FilterFilesFunction filterFilesFunction(const QStringList &filters,
const QStringList &exclusionFilters) const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion)
{ {
const QList<QRegularExpression> filterRegs = filtersToRegExps(filters); const QList<QRegularExpression> filterRegs = filtersToRegExps(filters);
const QList<QRegularExpression> exclusionRegs = filtersToRegExps(exclusionFilters); const QList<QRegularExpression> exclusionRegs = filtersToRegExps(exclusionFilters);
return [filterRegs, exclusionRegs](const FilePaths &filePaths) { return [filterRegs, exclusionRegs, filterFileFuntion](const FilePaths &filePaths) {
return Utils::filtered(filePaths, [&filterRegs, &exclusionRegs](const FilePath &filePath) { return Utils::filtered(filePaths, [&filterRegs, &exclusionRegs, filterFileFuntion](
return isFileIncluded(filterRegs, exclusionRegs, filePath); const FilePath &filePath) {
return isFileIncluded(filterRegs, exclusionRegs, filePath) &&
(!filterFileFuntion || filterFileFuntion(filePath));
}); });
}; };
} }
@@ -583,12 +586,14 @@ const int s_progressMaximum = 1000;
struct SubDirCache struct SubDirCache
{ {
SubDirCache(const FilePaths &directories, const QStringList &filters, SubDirCache(const FilePaths &directories, const QStringList &filters,
const QStringList &exclusionFilters, QTextCodec *encoding); const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion, QTextCodec *encoding);
std::optional<FileContainerIterator::Item> updateCache(int advanceIntoIndex, std::optional<FileContainerIterator::Item> updateCache(int advanceIntoIndex,
const SubDirCache &initialCache); const SubDirCache &initialCache);
std::function<FilePaths(const FilePaths &)> m_filterFiles; FilterFilesFunction m_filterFilesFunction;
FilterFileFunction m_filterFileFunction;
QTextCodec *m_encoding = nullptr; QTextCodec *m_encoding = nullptr;
QStack<FilePath> m_dirs; QStack<FilePath> m_dirs;
QSet<FilePath> m_knownDirs; QSet<FilePath> m_knownDirs;
@@ -606,8 +611,10 @@ struct SubDirCache
}; };
SubDirCache::SubDirCache(const FilePaths &directories, const QStringList &filters, SubDirCache::SubDirCache(const FilePaths &directories, const QStringList &filters,
const QStringList &exclusionFilters, QTextCodec *encoding) const QStringList &exclusionFilters,
: m_filterFiles(filterFilesFunction(filters, exclusionFilters)) const FilterFileFunction &filterFileFuntion, QTextCodec *encoding)
: m_filterFilesFunction(filterFilesFunction(filters, exclusionFilters, filterFileFuntion))
, m_filterFileFunction(filterFileFuntion)
, m_encoding(encoding == nullptr ? QTextCodec::codecForLocale() : encoding) , m_encoding(encoding == nullptr ? QTextCodec::codecForLocale() : encoding)
{ {
const qreal maxPer = qreal(s_progressMaximum) / directories.count(); const qreal maxPer = qreal(s_progressMaximum) / directories.count();
@@ -642,7 +649,7 @@ std::optional<FileContainerIterator::Item> SubDirCache::updateCache(int advanceI
const FilePath dir = m_dirs.pop(); const FilePath dir = m_dirs.pop();
const qreal dirProgressMax = m_progressValues.pop(); const qreal dirProgressMax = m_progressValues.pop();
const bool processed = m_processedValues.pop(); const bool processed = m_processedValues.pop();
if (dir.exists()) { if (dir.exists() && (!m_filterFileFunction || m_filterFileFunction(dir))) {
using Dir = FilePath; using Dir = FilePath;
using CanonicalDir = FilePath; using CanonicalDir = FilePath;
std::vector<std::pair<Dir, CanonicalDir>> subDirs; std::vector<std::pair<Dir, CanonicalDir>> subDirs;
@@ -657,7 +664,7 @@ std::optional<FileContainerIterator::Item> SubDirCache::updateCache(int advanceI
} }
if (subDirs.empty()) { if (subDirs.empty()) {
const FilePaths allFilePaths = dir.dirEntries(QDir::Files | QDir::Hidden); const FilePaths allFilePaths = dir.dirEntries(QDir::Files | QDir::Hidden);
const FilePaths filePaths = m_filterFiles(allFilePaths); const FilePaths filePaths = m_filterFilesFunction(allFilePaths);
m_items.reserve(m_items.size() + filePaths.size()); m_items.reserve(m_items.size() + filePaths.size());
Utils::reverseForeach(filePaths, [this](const FilePath &file) { Utils::reverseForeach(filePaths, [this](const FilePath &file) {
m_items.append({file, m_encoding}); m_items.append({file, m_encoding});
@@ -706,15 +713,25 @@ static FileContainerIterator::Advancer subDirAdvancer(const SubDirCache &initial
} }
static FileContainer::AdvancerProvider subDirAdvancerProvider(const FilePaths &directories, static FileContainer::AdvancerProvider subDirAdvancerProvider(const FilePaths &directories,
const QStringList &filters, const QStringList &exclusionFilters, QTextCodec *encoding) const QStringList &filters, const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion, QTextCodec *encoding)
{ {
const SubDirCache initialCache(directories, filters, exclusionFilters, encoding); const SubDirCache initialCache(directories, filters, exclusionFilters, filterFileFuntion,
return [=] { return subDirAdvancer(initialCache); }; encoding);
return [initialCache] { return subDirAdvancer(initialCache); };
} }
SubDirFileContainer::SubDirFileContainer(const FilePaths &directories, const QStringList &filters, SubDirFileContainer::SubDirFileContainer(const FilePaths &directories, const QStringList &filters,
const QStringList &exclusionFilters, QTextCodec *encoding) const QStringList &exclusionFilters, QTextCodec *encoding)
: FileContainer(subDirAdvancerProvider(directories, filters, exclusionFilters, encoding), : FileContainer(subDirAdvancerProvider(directories, filters, exclusionFilters, {}, encoding),
s_progressMaximum) {} s_progressMaximum)
{}
SubDirFileContainer::SubDirFileContainer(const FilePaths &directories,
const FilterFileFunction &filterFileFuntion,
QTextCodec *encoding)
: FileContainer(subDirAdvancerProvider(directories, {}, {}, filterFileFuntion, encoding),
s_progressMaximum)
{}
} // namespace Utils } // namespace Utils

View File

@@ -31,6 +31,9 @@ enum FindFlag {
}; };
Q_DECLARE_FLAGS(FindFlags, FindFlag) Q_DECLARE_FLAGS(FindFlags, FindFlag)
using FilterFileFunction = std::function<bool(const FilePath &filePath)>;
using FilterFilesFunction = std::function<FilePaths(const FilePaths &filePath)>;
QTCREATOR_UTILS_EXPORT QTCREATOR_UTILS_EXPORT
QTextDocument::FindFlags textDocumentFlagsForFindFlags(FindFlags flags); QTextDocument::FindFlags textDocumentFlagsForFindFlags(FindFlags flags);
@@ -39,8 +42,9 @@ void searchInContents(QPromise<SearchResultItems> &promise, const QString &searc
FindFlags flags, const FilePath &filePath, const QString &contents); FindFlags flags, const FilePath &filePath, const QString &contents);
QTCREATOR_UTILS_EXPORT QTCREATOR_UTILS_EXPORT
std::function<FilePaths(const FilePaths &)> filterFilesFunction(const QStringList &filters, FilterFilesFunction filterFilesFunction(const QStringList &filters,
const QStringList &exclusionFilters); const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion = {});
QTCREATOR_UTILS_EXPORT QTCREATOR_UTILS_EXPORT
QStringList splitFilterUiText(const QString &text); QStringList splitFilterUiText(const QString &text);
@@ -150,9 +154,10 @@ public:
class QTCREATOR_UTILS_EXPORT SubDirFileContainer : public FileContainer class QTCREATOR_UTILS_EXPORT SubDirFileContainer : public FileContainer
{ {
public: public:
SubDirFileContainer(const FilePaths &directories, const QStringList &filters,
const QStringList &exclusionFilters, QTextCodec *encoding = nullptr);
SubDirFileContainer(const FilePaths &directories, SubDirFileContainer(const FilePaths &directories,
const QStringList &filters, const FilterFileFunction &filterFileFuntion = {},
const QStringList &exclusionFilters,
QTextCodec *encoding = nullptr); QTextCodec *encoding = nullptr);
}; };

View File

@@ -283,7 +283,7 @@ QVariant ParseContext::readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttr
} }
QVariant value; QVariant value;
value.setValue(text); value.setValue(text);
value.convert(QMetaType::type(type.toLatin1().constData())); value.convert(QMetaType::fromName(type.toLatin1().constData()));
return value; return value;
} }

View File

@@ -16,8 +16,8 @@
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <psapi.h>
#include <windows.h> #include <windows.h>
#include <psapi.h>
#endif #endif
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS

View File

@@ -52,7 +52,9 @@ ManualRunDialog::ManualRunDialog(const ProjectExplorer::Project *project)
analyzeButton->setEnabled(m_model->hasCheckedFiles()); analyzeButton->setEnabled(m_model->hasCheckedFiles());
}); });
auto optionsWidget = settings().layouter()().emerge(); m_manualRunSettings.readSettings();
m_manualRunSettings.setAutoApply(true);
auto optionsWidget = m_manualRunSettings.layouter()().emerge();
auto layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
layout->addWidget(optionsWidget); layout->addWidget(optionsWidget);

View File

@@ -3,6 +3,8 @@
#pragma once #pragma once
#include "cppchecksettings.h"
#include <QDialog> #include <QDialog>
namespace Utils { namespace Utils {
@@ -25,8 +27,10 @@ public:
Utils::FilePaths filePaths() const; Utils::FilePaths filePaths() const;
QSize sizeHint() const override; QSize sizeHint() const override;
const CppcheckSettings &manualRunSettings() const { return m_manualRunSettings; }
private: private:
ProjectExplorer::SelectableFilesFromDirModel *m_model; ProjectExplorer::SelectableFilesFromDirModel *m_model;
CppcheckSettings m_manualRunSettings;
}; };
} // Cppcheck::Internal } // Cppcheck::Internal

View File

@@ -56,9 +56,9 @@ public:
CppcheckPluginPrivate::CppcheckPluginPrivate() CppcheckPluginPrivate::CppcheckPluginPrivate()
{ {
tool.updateOptions(); tool.updateOptions(settings());
connect(&settings(), &AspectContainer::changed, this, [this] { connect(&settings(), &AspectContainer::changed, this, [this] {
tool.updateOptions(); tool.updateOptions(settings());
trigger.recheck(); trigger.recheck();
}); });
@@ -112,8 +112,6 @@ void CppcheckPluginPrivate::startManualRun()
if (!project) if (!project)
return; return;
manualRunTool.updateOptions();
ManualRunDialog dialog(project); ManualRunDialog dialog(project);
if (dialog.exec() == ManualRunDialog::Rejected) if (dialog.exec() == ManualRunDialog::Rejected)
return; return;
@@ -125,7 +123,7 @@ void CppcheckPluginPrivate::startManualRun()
return; return;
manualRunTool.setProject(project); manualRunTool.setProject(project);
manualRunTool.updateOptions(); manualRunTool.updateOptions(dialog.manualRunSettings());
manualRunTool.check(files); manualRunTool.check(files);
perspective.select(); perspective.select();
} }

View File

@@ -39,10 +39,10 @@ CppcheckTool::CppcheckTool(CppcheckDiagnosticManager &manager, const Id &progres
CppcheckTool::~CppcheckTool() = default; CppcheckTool::~CppcheckTool() = default;
void CppcheckTool::updateOptions() void CppcheckTool::updateOptions(const CppcheckSettings &settings)
{ {
m_filters.clear(); m_filters.clear();
for (const QString &pattern : settings().ignoredPatterns().split(',')) { for (const QString &pattern : settings.ignoredPatterns().split(',')) {
const QString trimmedPattern = pattern.trimmed(); const QString trimmedPattern = pattern.trimmed();
if (trimmedPattern.isEmpty()) if (trimmedPattern.isEmpty())
continue; continue;
@@ -52,56 +52,54 @@ void CppcheckTool::updateOptions()
m_filters.push_back(re); m_filters.push_back(re);
} }
updateArguments(); updateArguments(settings);
} }
void CppcheckTool::setProject(ProjectExplorer::Project *project) void CppcheckTool::setProject(ProjectExplorer::Project *project)
{ {
m_project = project; m_project = project;
updateArguments(); updateArguments(settings());
} }
void CppcheckTool::updateArguments() void CppcheckTool::updateArguments(const CppcheckSettings &settings)
{ {
if (!m_project) if (!m_project)
return; return;
m_cachedAdditionalArguments.clear(); m_cachedAdditionalArguments.clear();
CppcheckSettings &s = settings();
QStringList arguments; QStringList arguments;
if (!s.customArguments().isEmpty()) { if (!settings.customArguments().isEmpty()) {
Utils::MacroExpander *expander = Utils::globalMacroExpander(); Utils::MacroExpander *expander = Utils::globalMacroExpander();
const QString expanded = expander->expand(s.customArguments()); const QString expanded = expander->expand(settings.customArguments());
arguments.push_back(expanded); arguments.push_back(expanded);
} }
if (s.warning()) if (settings.warning())
arguments.push_back("--enable=warning"); arguments.push_back("--enable=warning");
if (s.style()) if (settings.style())
arguments.push_back("--enable=style"); arguments.push_back("--enable=style");
if (s.performance()) if (settings.performance())
arguments.push_back("--enable=performance"); arguments.push_back("--enable=performance");
if (s.portability()) if (settings.portability())
arguments.push_back("--enable=portability"); arguments.push_back("--enable=portability");
if (s.information()) if (settings.information())
arguments.push_back("--enable=information"); arguments.push_back("--enable=information");
if (s.unusedFunction()) if (settings.unusedFunction())
arguments.push_back("--enable=unusedFunction"); arguments.push_back("--enable=unusedFunction");
if (s.missingInclude()) if (settings.missingInclude())
arguments.push_back("--enable=missingInclude"); arguments.push_back("--enable=missingInclude");
if (s.inconclusive()) if (settings.inconclusive())
arguments.push_back("--inconclusive"); arguments.push_back("--inconclusive");
if (s.forceDefines()) if (settings.forceDefines())
arguments.push_back("--force"); arguments.push_back("--force");
if (!s.unusedFunction() && !s.customArguments().contains("-j ")) if (!settings.unusedFunction() && !settings.customArguments().contains("-j "))
arguments.push_back("-j " + QString::number(QThread::idealThreadCount())); arguments.push_back("-j " + QString::number(QThread::idealThreadCount()));
arguments.push_back("--template=\"{file},{line},{severity},{id},{message}\""); arguments.push_back("--template=\"{file},{line},{severity},{id},{message}\"");
m_runner->reconfigure(s.binary.effectiveBinary(), arguments.join(' ')); m_runner->reconfigure(settings.binary.effectiveBinary(), arguments.join(' '));
} }
QStringList CppcheckTool::additionalArguments(const CppEditor::ProjectPart &part) const QStringList CppcheckTool::additionalArguments(const CppEditor::ProjectPart &part) const

View File

@@ -24,6 +24,7 @@ namespace Cppcheck::Internal {
class CppcheckRunner; class CppcheckRunner;
class CppcheckDiagnosticManager; class CppcheckDiagnosticManager;
class CppcheckSettings;
class CppcheckTool final : public QObject class CppcheckTool final : public QObject
{ {
@@ -33,7 +34,7 @@ public:
CppcheckTool(CppcheckDiagnosticManager &manager, const Utils::Id &progressId); CppcheckTool(CppcheckDiagnosticManager &manager, const Utils::Id &progressId);
~CppcheckTool() override; ~CppcheckTool() override;
void updateOptions(); void updateOptions(const CppcheckSettings &settings);
void setProject(ProjectExplorer::Project *project); void setProject(ProjectExplorer::Project *project);
void check(const Utils::FilePaths &files); void check(const Utils::FilePaths &files);
void stop(const Utils::FilePaths &files); void stop(const Utils::FilePaths &files);
@@ -45,7 +46,7 @@ public:
void finishWithFail(const QString &exitMessage); void finishWithFail(const QString &exitMessage);
private: private:
void updateArguments(); void updateArguments(const CppcheckSettings &settings);
void addToQueue(const Utils::FilePaths &files, const CppEditor::ProjectPart &part); void addToQueue(const Utils::FilePaths &files, const CppEditor::ProjectPart &part);
QStringList additionalArguments(const CppEditor::ProjectPart &part) const; QStringList additionalArguments(const CppEditor::ProjectPart &part) const;

View File

@@ -237,6 +237,8 @@ void DapClient::emitSignals(const QJsonDocument &doc)
type = DapResponseType::SetBreakpoints; type = DapResponseType::SetBreakpoints;
} else if (command == "setFunctionBreakpoints") { } else if (command == "setFunctionBreakpoints") {
type = DapResponseType::SetFunctionBreakpoints; type = DapResponseType::SetFunctionBreakpoints;
} else if (command == "attach") {
type = DapResponseType::Attach;
} }
emit responseReady(type, ob); emit responseReady(type, ob);
return; return;

View File

@@ -54,6 +54,7 @@ enum class DapResponseType
Evaluate, Evaluate,
SetBreakpoints, SetBreakpoints,
SetFunctionBreakpoints, SetFunctionBreakpoints,
Attach,
Unknown Unknown
}; };

View File

@@ -7,7 +7,9 @@
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <debugger/debuggeractions.h>
#include <debugger/debuggermainwindow.h> #include <debugger/debuggermainwindow.h>
#include <debugger/debuggersourcepathmappingwidget.h>
#include <utils/mimeconstants.h> #include <utils/mimeconstants.h>
#include <utils/mimeutils.h> #include <utils/mimeutils.h>
@@ -18,6 +20,7 @@
#include <projectexplorer/projecttree.h> #include <projectexplorer/projecttree.h>
#include <QDebug> #include <QDebug>
#include <QJsonArray>
#include <QLocalSocket> #include <QLocalSocket>
#include <QVersionNumber> #include <QVersionNumber>
@@ -112,15 +115,69 @@ LldbDapEngine::LldbDapEngine()
setDebuggerType("DAP"); setDebuggerType("DAP");
} }
QJsonArray LldbDapEngine::sourceMap() const
{
QJsonArray sourcePathMapping;
const SourcePathMap sourcePathMap
= mergePlatformQtPath(runParameters(), settings().sourcePathMap());
for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd(); it != cend; ++it) {
sourcePathMapping.append(QJsonArray{
{it.key(), expand(it.value())},
});
}
return sourcePathMapping;
}
QJsonArray LldbDapEngine::preRunCommands() const
{
const QStringList lines = settings().gdbStartupCommands().split('\n')
+ runParameters().additionalStartupCommands.split('\n');
QJsonArray result;
for (const QString &line : lines) {
const QString trimmed = line.trimmed();
if (!trimmed.isEmpty() && !trimmed.startsWith('#'))
result.append(trimmed);
}
return result;
}
void LldbDapEngine::handleDapInitialize() void LldbDapEngine::handleDapInitialize()
{ {
// Documentation at:
// * https://github.com/llvm/llvm-project/tree/main/lldb/tools/lldb-dap#lldb-dap
// * https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/package.json
const DebuggerRunParameters &rp = runParameters();
if (!isLocalAttachEngine()) { if (!isLocalAttachEngine()) {
DapEngine::handleDapInitialize(); m_dapClient->postRequest(
"launch",
QJsonObject{
{"noDebug", false},
{"program", rp.inferior.command.executable().path()},
{"args", rp.inferior.command.arguments()},
{"cwd", rp.inferior.workingDirectory.path()},
{"sourceMap", sourceMap()},
{"preRunCommands", preRunCommands()},
{"__restart", ""},
});
qCDebug(logCategory()) << "handleDapLaunch";
return; return;
} }
QTC_ASSERT(state() == EngineRunRequested, qCDebug(logCategory()) << state()); QTC_ASSERT(state() == EngineRunRequested, qCDebug(logCategory()) << state());
m_dapClient->postRequest("attach", QJsonObject{{"__restart", ""}});
m_dapClient->postRequest(
"attach",
QJsonObject{
{"program", rp.inferior.command.executable().path()},
{"pid", QString::number(rp.attachPID.pid())},
{"sourceMap", sourceMap()},
{"preRunCommands", preRunCommands()},
{"__restart", ""},
});
qCDebug(logCategory()) << "handleDapAttach"; qCDebug(logCategory()) << "handleDapAttach";
} }
@@ -136,7 +193,7 @@ void LldbDapEngine::handleDapConfigurationDone()
return; return;
} }
notifyEngineRunAndInferiorStopOk(); notifyEngineRunAndInferiorRunOk();
} }
void LldbDapEngine::setupEngine() void LldbDapEngine::setupEngine()
@@ -146,9 +203,6 @@ void LldbDapEngine::setupEngine()
const DebuggerRunParameters &rp = runParameters(); const DebuggerRunParameters &rp = runParameters();
CommandLine cmd{rp.debugger.command.executable()}; CommandLine cmd{rp.debugger.command.executable()};
if (isLocalAttachEngine())
cmd.addArgs({"--debugger-pid", QString::number(rp.attachPID.pid())});
IDataProvider *dataProvider = new ProcessDataProvider(rp, cmd, this); IDataProvider *dataProvider = new ProcessDataProvider(rp, cmd, this);
m_dapClient = new LldbDapClient(dataProvider, this); m_dapClient = new LldbDapClient(dataProvider, this);

View File

@@ -21,6 +21,9 @@ private:
bool isLocalAttachEngine() const; bool isLocalAttachEngine() const;
bool acceptsBreakpoint(const BreakpointParameters &bp) const override; bool acceptsBreakpoint(const BreakpointParameters &bp) const override;
const QLoggingCategory &logCategory() override; const QLoggingCategory &logCategory() override;
QJsonArray sourceMap() const;
QJsonArray preRunCommands() const;
}; };
} // Debugger::Internal } // Debugger::Internal

View File

@@ -100,6 +100,8 @@ enum DebuggerEngineType
GdbEngineType = 0x001, GdbEngineType = 0x001,
CdbEngineType = 0x004, CdbEngineType = 0x004,
LldbEngineType = 0x100, LldbEngineType = 0x100,
GdbDapEngineType = 0x200,
LldbDapEngineType = 0x400,
UvscEngineType = 0x1000 UvscEngineType = 0x1000
}; };

View File

@@ -2625,6 +2625,8 @@ bool DebuggerRunParameters::isCppDebugging() const
return cppEngineType == GdbEngineType return cppEngineType == GdbEngineType
|| cppEngineType == LldbEngineType || cppEngineType == LldbEngineType
|| cppEngineType == CdbEngineType || cppEngineType == CdbEngineType
|| cppEngineType == GdbDapEngineType
|| cppEngineType == LldbDapEngineType
|| cppEngineType == UvscEngineType; || cppEngineType == UvscEngineType;
} }

View File

@@ -271,6 +271,10 @@ QString DebuggerItem::engineTypeName() const
return QLatin1String("CDB"); return QLatin1String("CDB");
case LldbEngineType: case LldbEngineType:
return QLatin1String("LLDB"); return QLatin1String("LLDB");
case GdbDapEngineType:
return QLatin1String("GDB DAP");
case LldbDapEngineType:
return QLatin1String("LLDB DAP");
case UvscEngineType: case UvscEngineType:
return QLatin1String("UVSC"); return QLatin1String("UVSC");
default: default:

View File

@@ -494,6 +494,12 @@ void DebuggerRunTool::start()
case LldbEngineType: case LldbEngineType:
m_engines << createLldbEngine(); m_engines << createLldbEngine();
break; break;
case GdbDapEngineType:
m_engines << createDapEngine(ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE);
break;
case LldbDapEngineType:
m_engines << createDapEngine(ProjectExplorer::Constants::DAP_LLDB_DEBUG_RUN_MODE);
break;
case UvscEngineType: case UvscEngineType:
m_engines << createUvscEngine(); m_engines << createUvscEngine();
break; break;

View File

@@ -848,6 +848,16 @@ void IosSimulatorToolHandlerPrivate::installAppOnSimulator()
futureSynchronizer.addFuture(Utils::onResultReady(installFuture, q, onResponseAppInstall)); futureSynchronizer.addFuture(Utils::onResultReady(installFuture, q, onResponseAppInstall));
} }
#ifdef Q_OS_UNIX
static void monitorPid(QPromise<void> &promise, qint64 pid)
{
do {
// Poll every 1 sec to check whether the app is running.
QThread::msleep(1000);
} while (!promise.isCanceled() && kill(pid, 0) == 0);
}
#endif
void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &extraArgs) void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &extraArgs)
{ {
const QString bundleId = SimulatorControl::bundleIdentifier(m_bundlePath); const QString bundleId = SimulatorControl::bundleIdentifier(m_bundlePath);
@@ -871,21 +881,7 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
"Install Xcode 8 or later.").arg(bundleId)); "Install Xcode 8 or later.").arg(bundleId));
} }
auto monitorPid = [this](QPromise<void> &promise, qint64 pid) { auto onResponseAppLaunch = [this, captureConsole, stdoutFile, stderrFile](
#ifdef Q_OS_UNIX
do {
// Poll every 1 sec to check whether the app is running.
QThread::msleep(1000);
} while (!promise.isCanceled() && kill(pid, 0) == 0);
#else
Q_UNUSED(pid)
#endif
// Future is cancelled if the app is stopped from the qt creator.
if (!promise.isCanceled())
stop(0);
};
auto onResponseAppLaunch = [this, captureConsole, monitorPid, stdoutFile, stderrFile](
const SimulatorControl::Response &response) { const SimulatorControl::Response &response) {
if (response) { if (response) {
if (!isResponseValid(*response)) if (!isResponseValid(*response))
@@ -893,8 +889,15 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
m_pid = response->inferiorPid; m_pid = response->inferiorPid;
gotInferiorPid(m_bundlePath, m_deviceId, response->inferiorPid); gotInferiorPid(m_bundlePath, m_deviceId, response->inferiorPid);
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Success); didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Success);
#ifdef Q_OS_UNIX
// Start monitoring app's life signs. // Start monitoring app's life signs.
futureSynchronizer.addFuture(Utils::asyncRun(monitorPid, response->inferiorPid)); futureSynchronizer.addFuture(Utils::onFinished(
Utils::asyncRun(monitorPid, response->inferiorPid), q,
[this](const QFuture<void> &future) {
if (!future.isCanceled())
stop(0);
}));
#endif
if (captureConsole) if (captureConsole)
futureSynchronizer.addFuture(Utils::asyncRun(&LogTailFiles::exec, &outputLogger, futureSynchronizer.addFuture(Utils::asyncRun(&LogTailFiles::exec, &outputLogger,
stdoutFile, stderrFile)); stdoutFile, stderrFile));

View File

@@ -55,7 +55,7 @@ FileContainer AllProjectsFind::filesForProjects(const QStringList &nameFilters,
const QStringList &exclusionFilters, const QStringList &exclusionFilters,
const QList<Project *> &projects) const QList<Project *> &projects)
{ {
std::function<FilePaths(const FilePaths &)> filterFiles const FilterFilesFunction filterFiles
= Utils::filterFilesFunction(nameFilters, exclusionFilters); = Utils::filterFilesFunction(nameFilters, exclusionFilters);
const QMap<FilePath, QTextCodec *> openEditorEncodings const QMap<FilePath, QTextCodec *> openEditorEncodings
= TextDocument::openedTextDocumentEncodings(); = TextDocument::openedTextDocumentEncodings();

View File

@@ -30,7 +30,8 @@ enum {
ItemUpdatedFromBelowRole, // A subitem got updated, re-expansion is necessary. ItemUpdatedFromBelowRole, // A subitem got updated, re-expansion is necessary.
ActiveItemRole, // The index of the currently selected item in the tree view ActiveItemRole, // The index of the currently selected item in the tree view
KitIdRole, // The kit id in case the item is associated with a kit. KitIdRole, // The kit id in case the item is associated with a kit.
PanelWidgetRole // This item's widget to be shown as central widget. PanelWidgetRole, // This item's widget to be shown as central widget.
IsShowMoreRole // This item is a "show more" item.
}; };
class ProjectWindowPrivate; class ProjectWindowPrivate;

View File

@@ -170,6 +170,7 @@ public:
void ensureWidget(); void ensureWidget();
void rebuildContents(); void rebuildContents();
void ensureShowMoreItem();
void setShowAllKits(bool showAllKits) void setShowAllKits(bool showAllKits)
{ {
@@ -206,6 +207,10 @@ public:
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
return !m_p->showAllKits() ? Tr::tr("Show All Kits") : Tr::tr("Hide Inactive Kits"); return !m_p->showAllKits() ? Tr::tr("Show All Kits") : Tr::tr("Hide Inactive Kits");
} }
if (role == IsShowMoreRole)
return true;
return {}; return {};
} }
@@ -814,6 +819,14 @@ void TargetItem::updateSubItems()
} }
} }
void TargetGroupItemPrivate::ensureShowMoreItem()
{
if (q->findAnyChild([](TreeItem *item) { return item->data(0, IsShowMoreRole).toBool(); }))
return;
q->appendChild(new ShowMoreItem(this));
}
void TargetGroupItemPrivate::rebuildContents() void TargetGroupItemPrivate::rebuildContents()
{ {
QGuiApplication::setOverrideCursor(Qt::WaitCursor); QGuiApplication::setOverrideCursor(Qt::WaitCursor);
@@ -829,7 +842,7 @@ void TargetGroupItemPrivate::rebuildContents()
} }
if (isAnyKitNotEnabled) if (isAnyKitNotEnabled)
q->appendChild(new ShowMoreItem(this)); ensureShowMoreItem();
if (q->parent()) { if (q->parent()) {
q->parent() q->parent()
@@ -843,6 +856,7 @@ void TargetGroupItemPrivate::handleTargetAdded(Target *target)
{ {
if (TargetItem *item = q->targetItem(target)) if (TargetItem *item = q->targetItem(target))
item->updateSubItems(); item->updateSubItems();
ensureShowMoreItem();
q->update(); q->update();
} }
@@ -850,6 +864,7 @@ void TargetGroupItemPrivate::handleTargetRemoved(Target *target)
{ {
if (TargetItem *item = q->targetItem(target)) if (TargetItem *item = q->targetItem(target))
item->updateSubItems(); item->updateSubItems();
ensureShowMoreItem();
q->parent()->setData(0, QVariant::fromValue(static_cast<TreeItem *>(q)), q->parent()->setData(0, QVariant::fromValue(static_cast<TreeItem *>(q)),
ItemDeactivatedFromBelowRole); ItemDeactivatedFromBelowRole);
} }
@@ -858,6 +873,7 @@ void TargetGroupItemPrivate::handleTargetChanged(Target *target)
{ {
if (TargetItem *item = q->targetItem(target)) if (TargetItem *item = q->targetItem(target))
item->updateSubItems(); item->updateSubItems();
ensureShowMoreItem();
q->setData(0, QVariant(), ItemActivatedFromBelowRole); q->setData(0, QVariant(), ItemActivatedFromBelowRole);
} }

View File

@@ -149,7 +149,7 @@ IAssistProposal *MergedCompletionAssistProcessor::perform()
}); });
m_qbsProcessor->start(std::make_unique<AssistInterface>(m_interface->cursor(), m_qbsProcessor->start(std::make_unique<AssistInterface>(m_interface->cursor(),
m_interface->filePath(), m_interface->filePath(),
ExplicitlyInvoked)); m_interface->reason()));
} else { } else {
m_qbsProposal = nullptr; m_qbsProposal = nullptr;
} }
@@ -162,7 +162,7 @@ IAssistProposal *MergedCompletionAssistProcessor::perform()
return m_qmlProcessor->start( return m_qmlProcessor->start(
std::make_unique<QmlJSCompletionAssistInterface>(qmlJsIface->cursor(), std::make_unique<QmlJSCompletionAssistInterface>(qmlJsIface->cursor(),
qmlJsIface->filePath(), qmlJsIface->filePath(),
ExplicitlyInvoked, m_interface->reason(),
qmlJsIface->semanticInfo())); qmlJsIface->semanticInfo()));
} }

View File

@@ -27,7 +27,7 @@ void BakeLightsConnectionManager::setFinishedCallback(Callback callback)
void BakeLightsConnectionManager::dispatchCommand(const QVariant &command, void BakeLightsConnectionManager::dispatchCommand(const QVariant &command,
ConnectionManagerInterface::Connection &) ConnectionManagerInterface::Connection &)
{ {
static const int commandType = QMetaType::type("PuppetToCreatorCommand"); static const int commandType = QMetaType::fromName("PuppetToCreatorCommand").id();
if (command.typeId() == commandType) { if (command.typeId() == commandType) {
auto cmd = command.value<PuppetToCreatorCommand>(); auto cmd = command.value<PuppetToCreatorCommand>();

View File

@@ -45,7 +45,7 @@ bool ImageCacheConnectionManager::waitForCapturedData()
void ImageCacheConnectionManager::dispatchCommand(const QVariant &command, void ImageCacheConnectionManager::dispatchCommand(const QVariant &command,
ConnectionManagerInterface::Connection &) ConnectionManagerInterface::Connection &)
{ {
static const int capturedDataCommandType = QMetaType::type("CapturedDataCommand"); static const int capturedDataCommandType = QMetaType::fromName("CapturedDataCommand").id();
if (command.typeId() == capturedDataCommandType) { if (command.typeId() == capturedDataCommandType) {
m_captureCallback(command.value<CapturedDataCommand>().image); m_captureCallback(command.value<CapturedDataCommand>().image);

View File

@@ -107,8 +107,8 @@ void BaseConnectionManager::readDataStream(Connection &connection)
connection.blockSize = 0; connection.blockSize = 0;
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED #ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
if (command.typeId() != QMetaType::type("PuppetAliveCommand")) { if (command.typeId() != QMetaType::fromName("PuppetAliveCommand").id()) {
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) { if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>(); SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
NANOTRACE_INSTANT_ARGS("Sync", "readCommand", NANOTRACE_INSTANT_ARGS("Sync", "readCommand",
{"name", cmd.name().toStdString()}, {"name", cmd.name().toStdString()},

View File

@@ -68,7 +68,7 @@ void InteractiveConnectionManager::showCannotConnectToPuppetWarningAndSwitchToEd
void InteractiveConnectionManager::dispatchCommand(const QVariant &command, Connection &connection) void InteractiveConnectionManager::dispatchCommand(const QVariant &command, Connection &connection)
{ {
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand"); static const int puppetAliveCommandType = QMetaType::fromName("PuppetAliveCommand").id();
if (command.typeId() == puppetAliveCommandType) { if (command.typeId() == puppetAliveCommandType) {
puppetAlive(connection); puppetAlive(connection);

View File

@@ -93,18 +93,18 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
{ {
NANOTRACE_SCOPE_ARGS("Update", "dispatchCommand", {"name", command.typeName()}); NANOTRACE_SCOPE_ARGS("Update", "dispatchCommand", {"name", command.typeName()});
static const int informationChangedCommandType = QMetaType::type("InformationChangedCommand"); static const int informationChangedCommandType = QMetaType::fromName("InformationChangedCommand").id();
static const int valuesChangedCommandType = QMetaType::type("ValuesChangedCommand"); static const int valuesChangedCommandType = QMetaType::fromName("ValuesChangedCommand").id();
static const int valuesModifiedCommandType = QMetaType::type("ValuesModifiedCommand"); static const int valuesModifiedCommandType = QMetaType::fromName("ValuesModifiedCommand").id();
static const int pixmapChangedCommandType = QMetaType::type("PixmapChangedCommand"); static const int pixmapChangedCommandType = QMetaType::fromName("PixmapChangedCommand").id();
static const int childrenChangedCommandType = QMetaType::type("ChildrenChangedCommand"); static const int childrenChangedCommandType = QMetaType::fromName("ChildrenChangedCommand").id();
static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand"); static const int statePreviewImageChangedCommandType = QMetaType::fromName("StatePreviewImageChangedCommand").id();
static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand"); static const int componentCompletedCommandType = QMetaType::fromName("ComponentCompletedCommand").id();
static const int tokenCommandType = QMetaType::type("TokenCommand"); static const int tokenCommandType = QMetaType::fromName("TokenCommand").id();
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand"); static const int debugOutputCommandType = QMetaType::fromName("DebugOutputCommand").id();
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand"); static const int changeSelectionCommandType = QMetaType::fromName("ChangeSelectionCommand").id();
static const int puppetToCreatorCommandType = QMetaType::type("PuppetToCreatorCommand"); static const int puppetToCreatorCommandType = QMetaType::fromName("PuppetToCreatorCommand").id();
static const int SyncNanotraceCommandType = QMetaType::type("SyncNanotraceCommand"); static const int SyncNanotraceCommandType = QMetaType::fromName("SyncNanotraceCommand").id();
qCInfo(instanceViewBenchmark) << "dispatching command" << command.typeId() << command.typeName(); qCInfo(instanceViewBenchmark) << "dispatching command" << command.typeId() << command.typeName();
if (command.typeId() == informationChangedCommandType) { if (command.typeId() == informationChangedCommandType) {
@@ -173,7 +173,7 @@ QString NodeInstanceServerProxy::qrcMappingString() const
void NodeInstanceServerProxy::writeCommand(const QVariant &command) void NodeInstanceServerProxy::writeCommand(const QVariant &command)
{ {
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED #ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) { if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>(); SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
NANOTRACE_INSTANT_ARGS("Sync", "writeCommand", NANOTRACE_INSTANT_ARGS("Sync", "writeCommand",
{"name", cmd.name().toStdString()}, {"name", cmd.name().toStdString()},

View File

@@ -201,7 +201,7 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &)
QVariant read(const QString &typeStr, const QString &str) QVariant read(const QString &typeStr, const QString &str)
{ {
int type = QMetaType::fromName(typeStr.toUtf8().constData()).id(); int type = QMetaType::fromName(typeStr.toUtf8()).id();
if (type == 0) { if (type == 0) {
if (typeStr != "binding"_L1 && typeStr != "enum"_L1) { if (typeStr != "binding"_L1 && typeStr != "enum"_L1) {
qWarning() << "Type " << typeStr qWarning() << "Type " << typeStr
@@ -266,7 +266,7 @@ QVariant read(int variantType, const QString &str)
value = vector3DFromString(str, &conversionOk); value = vector3DFromString(str, &conversionOk);
break; break;
default: { default: {
if (variantType == QMetaType::type("Enumeration")) { if (variantType == QMetaType::fromName("Enumeration").id()) {
value = QVariant::fromValue<Enumeration>(enumerationFromString(str, &conversionOk)); value = QVariant::fromValue<Enumeration>(enumerationFromString(str, &conversionOk));
} else { } else {
value = QVariant(str); value = QVariant(str);

View File

@@ -242,23 +242,23 @@ bool isLiteralValue(AST::UiScriptBinding *script)
int propertyType(const QString &typeName) int propertyType(const QString &typeName)
{ {
if (typeName == u"bool") if (typeName == u"bool")
return QMetaType::type("bool"); return QMetaType::fromName("bool").id();
else if (typeName == u"color") else if (typeName == u"color")
return QMetaType::type("QColor"); return QMetaType::fromName("QColor").id();
else if (typeName == u"date") else if (typeName == u"date")
return QMetaType::type("QDate"); return QMetaType::fromName("QDate").id();
else if (typeName == u"int") else if (typeName == u"int")
return QMetaType::type("int"); return QMetaType::fromName("int").id();
else if (typeName == u"real") else if (typeName == u"real")
return QMetaType::type("double"); return QMetaType::fromName("double").id();
else if (typeName == u"double") else if (typeName == u"double")
return QMetaType::type("double"); return QMetaType::fromName("double").id();
else if (typeName == u"string") else if (typeName == u"string")
return QMetaType::type("QString"); return QMetaType::fromName("QString").id();
else if (typeName == u"url") else if (typeName == u"url")
return QMetaType::type("QUrl"); return QMetaType::fromName("QUrl").id();
else if (typeName == u"var" || typeName == u"variant") else if (typeName == u"var" || typeName == u"variant")
return QMetaType::type("QVariant"); return QMetaType::fromName("QVariant").id();
else else
return -1; return -1;
} }
@@ -272,7 +272,7 @@ QVariant convertDynamicPropertyValueToVariant(const QString &astValue,
return QString(); return QString();
const int type = propertyType(astType); const int type = propertyType(astType);
if (type == QMetaType::type("QVariant")) { if (type == QMetaType::fromName("QVariant").id()) {
if (cleanedValue.isNull()) // Explicitly isNull, NOT isEmpty! if (cleanedValue.isNull()) // Explicitly isNull, NOT isEmpty!
return QVariant(static_cast<QVariant::Type>(type)); return QVariant(static_cast<QVariant::Type>(type));
else else

View File

@@ -391,8 +391,8 @@ void NodeInstanceClientProxy::readDataStream()
QVariant command = readCommandFromIOStream(m_inputIoDevice, &readCommandCounter, &blockSize); QVariant command = readCommandFromIOStream(m_inputIoDevice, &readCommandCounter, &blockSize);
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED #ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
if (command.typeId() != QMetaType::type("EndNanotraceCommand")) { if (command.typeId() != QMetaType::fromName("EndNanotraceCommand").id()) {
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) { if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>(); SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
NANOTRACE_INSTANT_ARGS("Sync", "readCommand", NANOTRACE_INSTANT_ARGS("Sync", "readCommand",
{"name", cmd.name().toStdString()}, {"name", cmd.name().toStdString()},

View File

@@ -38,7 +38,7 @@ void TestConnectionManager::writeCommand(const QVariant &command)
void TestConnectionManager::dispatchCommand(const QVariant &command, Connection &connection) void TestConnectionManager::dispatchCommand(const QVariant &command, Connection &connection)
{ {
static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand"); static const int synchronizeCommandType = QMetaType::fromName("SynchronizeCommand").id();
if (command.typeId() == synchronizeCommandType) { if (command.typeId() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>(); SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();