Merge remote-tracking branch 'origin/12.0'

Change-Id: I6309a8ffb18e40a581301bd275390395e250543c
This commit is contained in:
Eike Ziller
2023-10-26 14:28:02 +02:00
30 changed files with 267 additions and 113 deletions

View File

@@ -212,7 +212,9 @@ Projects
* Added auto-detection of PySide from the installer * Added auto-detection of PySide from the installer
([PYSIDE-2153](https://bugreports.qt.io/browse/PYSIDE-2153)) ([PYSIDE-2153](https://bugreports.qt.io/browse/PYSIDE-2153))
([Documentation](https://doc-snapshots.qt.io/qtcreator-12.0/creator-python-development.html#set-up-pyside6))
* Added the option to forward the display for remote Linux * Added the option to forward the display for remote Linux
([Documentation](https://doc-snapshots.qt.io/qtcreator-12.0/creator-run-settings.html#specifying-run-settings-for-linux-based-devices))
* Fixed PySide wheels installation on macOS * Fixed PySide wheels installation on macOS
### vcpkg ### vcpkg
@@ -224,6 +226,7 @@ Projects
### Qt Safe Renderer ### Qt Safe Renderer
* Added a wizard for Qt Safe Renderer 2.1 and later * Added a wizard for Qt Safe Renderer 2.1 and later
([Documentation](https://doc.qt.io/QtSafeRenderer/qtsr-safety-project.html#using-qt-safe-renderer-project-template-in-qt-creator))
Debugging Debugging
--------- ---------

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@@ -94,7 +94,7 @@
You can enable or disable QML debugging globally in \preferences > You can enable or disable QML debugging globally in \preferences >
\uicontrol {Build & Run} > \uicontrol {Default Build Properties}. \uicontrol {Build & Run} > \uicontrol {Default Build Properties}.
\image qtcreator-build-settings-default.png "Default Build Properties tab in Build & Run Preferences" \image qtcreator-build-settings-default.webp "Default Build Properties tab in Build & Run Preferences"
The value of the \uicontrol {QML debugging} field determines what happens The value of the \uicontrol {QML debugging} field determines what happens
when creating new build configurations. The values \uicontrol Enable when creating new build configurations. The values \uicontrol Enable

View File

@@ -712,6 +712,8 @@
\uicontrol {Disable messages for non Qt Quick UI}. You cannot \uicontrol {Disable messages for non Qt Quick UI}. You cannot
enable messages just for non-Qt Quick UI files. enable messages just for non-Qt Quick UI files.
\sa {QML Language Server}
\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

@@ -143,15 +143,22 @@
\section2 QML Language Server \section2 QML Language Server
Since Qt 6.4, the \c qmlls language server offers code completion and Since Qt 6.4, the QML language server offers code completion and
issues warnings for QML. To enable QML language server support, select issues warnings for QML. To use it, select \preferences >
\preferences > \uicontrol {Qt Quick} > \uicontrol {Qt Quick} > \uicontrol {QML/JS Editing} >
\uicontrol {QML/JS Editing} > \uicontrol {Use qmlls (EXPERIMENTAL!)}. \uicontrol {Enable QML Language Server}.
To use advanced features, such as renaming and finding usages, select the
\uicontrol {Use QML Language Server advanced features} check box.
To use the latest version of the language server installed on your To use the latest version of the language server installed on your
system, select the \uicontrol {Always use latest qmlls} check box. system, select the
\uicontrol {Use QML Language Server from latest Qt version} check box.
\image qtcreator-qml-js-editing.webp {QML/JS Editing preferences} \image qtcreator-qml-js-editing.webp {QML/JS Editing preferences}
\sa {Enabling and Disabling Messages}
\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

@@ -26,8 +26,19 @@
\li \uicontrol {\QC} > \uicontrol Preferences \li \uicontrol {\QC} > \uicontrol Preferences
\endtable \endtable
\section1 Filter preferences
To find a particular preference, use the filter located at the top left of To find a particular preference, use the filter located at the top left of
the \uicontrol Preferences dialog. the \uicontrol Preferences dialog.
\image qtcreator-preferences.webp {Filtering preferences} \image qtcreator-preferences.webp {Filtering preferences}
\section1 Go to tabs in Preferences
To go to a tab in the \uicontrol Preferences dialog from anywhere in \QC,
use the \c t \l{Searching with the Locator}{locator} filter. For example,
to open the \uicontrol Interface tab, enter \c {t preferences interface}
in the locator.
\image qtcreator-locator-filter-t.webp {Using the locator to open a tab in Preferences}
*/ */

View File

@@ -21,10 +21,13 @@
command in the \uicontrol {Alternate executable on device} field and select the command in the \uicontrol {Alternate executable on device} field and select the
\uicontrol {Use this command instead} check box. \uicontrol {Use this command instead} check box.
\image qtcreator-run-settings-linux.png "Run settings for Linux-based devices" \image qtcreator-run-settings-remote-linux.webp {Run settings for Linux-based devices}
You can specify arguments to pass to your application in the You can specify arguments to pass to your application in the
\uicontrol {Command line arguments} field. \uicontrol {Command line arguments} field.
Select the \uicontrol {Forward to local display} check box to show a remotely
running X11 client on a local display.
//! [run settings linux] //! [run settings linux]
*/ */

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 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*! /*!
@@ -8,15 +8,22 @@
\title qmake Build Configuration \title qmake Build Configuration
\image qtcreator-projectpane.png "qmake build settings" Specify build settings for the selected \l{glossary-buildandrun-kit}
{build and run kit} in \uicontrol Projects > \uicontrol {Build & Run}
> \uicontrol Build > \uicontrol {Build Settings}.
\image qtcreator-projectpane.webp {qmake build settings}
By default, \QC builds qmake projects in a separate directory from the By default, \QC builds qmake projects in a separate directory from the
source directory, as \l{glossary-shadow-build} {shadow builds}. This source directory, as \l{glossary-shadow-build} {shadow builds}. This
keeps the files generated for each \l{glossary-buildandrun-kit} keeps the files generated for each kit separate. If you only build and
{build and run kit} separate. If you only build and run with a single run with a single kit, you can deselect the \uicontrol {Shadow build}
\l{glossary-buildandrun-kit}{kit}, you can deselect the checkbox.
\uicontrol {Shadow build} checkbox. Select the build directory in the
\uicontrol {Build Directory} field. Select the build directory in the \uicontrol {Build Directory} field. You
can use the \l{Using Qt Creator Variables}{variables} that are listed when
you select the \inlineimage icons/replace.png (\uicontrol {Variables})
button.
To make in-source builds the default option for all projects, select To make in-source builds the default option for all projects, select
\preferences > \uicontrol {Build & Run} > \preferences > \uicontrol {Build & Run} >
@@ -54,7 +61,14 @@
To set the default build properties, select \preferences > To set the default build properties, select \preferences >
\uicontrol {Build & Run} > \uicontrol {Default Build Properties}. \uicontrol {Build & Run} > \uicontrol {Default Build Properties}.
\image qtcreator-build-settings-default.png "Default Build Properties tab in Build & Run Preferences" \image qtcreator-build-settings-default.webp {Default Build Properties tab in Build & Run Preferences}
In the \uicontrol {Default build directory} field, you can use the variables
that are listed when you select \inlineimage icons/replace.png, as well as
variables that are available for a particular kit. Those you can see when
you select the button in the \uicontrol Projects > \uicontrol {Build & Run} >
\uicontrol Build > \uicontrol {Build Settings} > \uicontrol {Build Directory}
field for a kit.
\section1 Compiling QML \section1 Compiling QML

View File

@@ -35,7 +35,8 @@
\section1 Managing Build Configurations \section1 Managing Build Configurations
Specify build settings in \uicontrol Projects > \uicontrol {Build & Run} Specify build settings for the selected \l{glossary-buildandrun-kit}
{build and run kit} in \uicontrol Projects > \uicontrol {Build & Run}
> \uicontrol Build > \uicontrol {Build Settings}. > \uicontrol Build > \uicontrol {Build Settings}.
\image qtcreator-build-configurations.png "Build Settings" \image qtcreator-build-configurations.png "Build Settings"

View File

@@ -428,12 +428,14 @@ void FancyLineEdit::setFiltering(bool on)
d->m_isFiltering = on; d->m_isFiltering = on;
if (on) { if (on) {
d->m_lastFilterText = text(); d->m_lastFilterText = text();
// KDE has custom icons for this. Notice that icon namings are counter intuitive. // KDE has custom icons for this. The "ltr" and "rtl" suffixes describe the direction
// If these icons are not available we use the freedesktop standard name before // into which the arrows are pointing. They do not describe which writing direction they
// falling back to a bundled resource. // are intended to be used for.
static const QIcon rtl = Icon::fromTheme("edit-clear-locationbar-rtl"); const QLatin1String pointingWest("edit-clear-locationbar-rtl");
static const QIcon ltr = Icon::fromTheme("edit-clear-locationbar-ltr"); const QLatin1String pointingEast("edit-clear-locationbar-ltr");
setButtonIcon(Right, layoutDirection() == Qt::LeftToRight ? ltr : rtl); const QIcon icon = Icon::fromTheme(layoutDirection() == Qt::LeftToRight ? pointingWest
: pointingEast);
setButtonIcon(Right, icon);
setButtonVisible(Right, true); setButtonVisible(Right, true);
setPlaceholderText(Tr::tr("Filter")); setPlaceholderText(Tr::tr("Filter"));
setButtonToolTip(Right, Tr::tr("Clear text")); setButtonToolTip(Right, Tr::tr("Clear text"));

View File

@@ -628,11 +628,6 @@ expected_str<qint64> FilePath::writeFileContents(const QByteArray &data, qint64
return fileAccess()->writeFileContents(*this, data, offset); return fileAccess()->writeFileContents(*this, data, offset);
} }
FilePathInfo FilePath::filePathInfo() const
{
return fileAccess()->filePathInfo(*this);
}
FileStreamHandle FilePath::asyncCopy(const FilePath &target, QObject *context, FileStreamHandle FilePath::asyncCopy(const FilePath &target, QObject *context,
const CopyContinuation &cont) const const CopyContinuation &cont) const
{ {
@@ -1188,6 +1183,14 @@ bool FilePath::hasFileAccess() const
return access.has_value(); return access.has_value();
} }
FilePathInfo FilePath::filePathInfo() const
{
const expected_str<DeviceFileAccess *> access = getFileAccess(*this);
if (!access)
return {};
return (*access)->filePathInfo(*this);
}
/*! /*!
Returns a bool indicating whether a file or directory with this FilePath exists. Returns a bool indicating whether a file or directory with this FilePath exists.
*/ */

View File

@@ -268,13 +268,14 @@ QIcon Icon::fromTheme(const QString &name)
cache.insert(name, !icon.isNull() ? icon : Icons::ZOOMOUT_TOOLBAR.icon()); cache.insert(name, !icon.isNull() ? icon : Icons::ZOOMOUT_TOOLBAR.icon());
} else if (name == "zoom-original") { } else if (name == "zoom-original") {
cache.insert(name, !icon.isNull() ? icon : Icons::EYE_OPEN_TOOLBAR.icon()); cache.insert(name, !icon.isNull() ? icon : Icons::EYE_OPEN_TOOLBAR.icon());
} else if (name == "edit-clear") {
cache.insert(name, !icon.isNull() ? icon : Icons::EDIT_CLEAR.icon());
} else if (name == "edit-clear-locationbar-rtl") { } else if (name == "edit-clear-locationbar-rtl") {
// KDE has custom icons for this. Notice that icon namings are counter intuitive. // KDE has custom icons for this. If these icons are not available we use the freedesktop
// If these icons are not available we use the freedesktop standard name before // standard name "edit-clear" before falling back to a bundled resource.
// falling back to a bundled resource. cache.insert(name, !icon.isNull() ? icon : fromTheme("edit-clear"));
cache.insert(name, !icon.isNull() ? icon : Icons::EDIT_CLEAR.icon());
} else if (name == "edit-clear-locationbar-ltr") { } else if (name == "edit-clear-locationbar-ltr") {
cache.insert(name, !icon.isNull() ? icon : Icons::EDIT_CLEAR.icon()); cache.insert(name, !icon.isNull() ? icon : fromTheme("edit-clear"));
} else { } else {
cache.insert(name, icon); cache.insert(name, icon);
} }

View File

@@ -158,12 +158,15 @@ bool AxivionPlugin::handleCertificateIssue()
AxivionPluginPrivate::AxivionPluginPrivate() AxivionPluginPrivate::AxivionPluginPrivate()
{ {
#if QT_CONFIG(ssl)
connect(&m_networkAccessManager, &QNetworkAccessManager::sslErrors, connect(&m_networkAccessManager, &QNetworkAccessManager::sslErrors,
this, &AxivionPluginPrivate::handleSslErrors); this, &AxivionPluginPrivate::handleSslErrors);
#endif // ssl
} }
void AxivionPluginPrivate::handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors) void AxivionPluginPrivate::handleSslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
{ {
#if QT_CONFIG(ssl)
const QList<QSslError::SslError> accepted{ const QList<QSslError::SslError> accepted{
QSslError::CertificateNotYetValid, QSslError::CertificateExpired, QSslError::CertificateNotYetValid, QSslError::CertificateExpired,
QSslError::InvalidCaCertificate, QSslError::CertificateUntrusted, QSslError::InvalidCaCertificate, QSslError::CertificateUntrusted,
@@ -174,6 +177,10 @@ void AxivionPluginPrivate::handleSslErrors(QNetworkReply *reply, const QList<QSs
if (!settings().server.validateCert || AxivionPlugin::handleCertificateIssue()) if (!settings().server.validateCert || AxivionPlugin::handleCertificateIssue())
reply->ignoreSslErrors(errors); reply->ignoreSslErrors(errors);
} }
#else // ssl
Q_UNUSED(reply)
Q_UNUSED(errors)
#endif // ssl
} }
void AxivionPluginPrivate::onStartupProjectChanged() void AxivionPluginPrivate::onStartupProjectChanged()

View File

@@ -456,9 +456,10 @@ void ClangdFindReferences::Private::addSearchResultsForFile(const FilePath &file
item.setContainingFunctionName(getContainingFunction(astPath, range).detail()); item.setContainingFunctionName(getContainingFunction(astPath, range).detail());
if (search->supportsReplace()) { if (search->supportsReplace()) {
const bool fileInSession = ProjectManager::projectForFile(file); const Node * const node = ProjectTree::nodeForFile(file);
item.setSelectForReplacement(fileInSession); item.setSelectForReplacement(!ProjectManager::hasProjects()
if (fileInSession && file.baseName().compare(replacementData->oldSymbolName, || (node && !node->isGenerated()));
if (node && file.baseName().compare(replacementData->oldSymbolName,
Qt::CaseInsensitive) == 0) { Qt::CaseInsensitive) == 0) {
replacementData->fileRenameCandidates << file; replacementData->fileRenameCandidates << file;
} }

View File

@@ -874,8 +874,10 @@ QWidget *ICore::dialogParent()
QWidget *active = QApplication::activeModalWidget(); QWidget *active = QApplication::activeModalWidget();
if (!active) if (!active)
active = QApplication::activeWindow(); active = QApplication::activeWindow();
if (!active || (active && active->windowFlags().testAnyFlags(Qt::SplashScreen | Qt::Popup))) if (!active || active->windowFlags().testFlag(Qt::SplashScreen)
|| active->windowFlags().testFlag(Qt::Popup)) {
active = d->m_mainwindow; active = d->m_mainwindow;
}
return active; return active;
} }

View File

@@ -8,6 +8,7 @@
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <QAction> #include <QAction>
#include <QPointer>
using namespace Utils; using namespace Utils;

View File

@@ -7,7 +7,9 @@
#include "coreplugintr.h" #include "coreplugintr.h"
#include "icore.h" #include "icore.h"
#include <utils/async.h>
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/fancylineedit.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/layoutbuilder.h> #include <utils/layoutbuilder.h>
#include <utils/listmodel.h> #include <utils/listmodel.h>
@@ -31,7 +33,6 @@
#include <QSplitter> #include <QSplitter>
#include <QToolButton> #include <QToolButton>
#include <QVBoxLayout> #include <QVBoxLayout>
namespace Core::Internal { namespace Core::Internal {
static QColor colorForCategory(const QString &category); static QColor colorForCategory(const QString &category);
@@ -209,6 +210,13 @@ public:
return false; return false;
} }
bool isEnabledOriginally(QtMsgType msgType) const
{
if (m_originalSettings)
return (*m_originalSettings)[msgType];
return isEnabled(msgType);
}
void setEnabled(QtMsgType msgType, bool isEnabled) void setEnabled(QtMsgType msgType, bool isEnabled)
{ {
QTC_ASSERT(!m_useOriginal, return); QTC_ASSERT(!m_useOriginal, return);
@@ -308,6 +316,8 @@ public:
~LoggingCategoryModel() override; ~LoggingCategoryModel() override;
enum Column { Color, Name, Debug, Warning, Critical, Fatal, Info }; enum Column { Color, Name, Debug, Warning, Critical, Fatal, Info };
enum Role { OriginalStateRole = Qt::UserRole + 1 };
void append(const LoggingCategoryEntry &entry); void append(const LoggingCategoryEntry &entry);
int columnCount(const QModelIndex &) const final { return 7; } int columnCount(const QModelIndex &) const final { return 7; }
int rowCount(const QModelIndex & = QModelIndex()) const final { return m_categories.size(); } int rowCount(const QModelIndex & = QModelIndex()) const final { return m_categories.size(); }
@@ -363,13 +373,19 @@ QVariant LoggingCategoryModel::data(const QModelIndex &index, int role) const
static const QColor defaultColor = Utils::creatorTheme()->palette().text().color(); static const QColor defaultColor = Utils::creatorTheme()->palette().text().color();
return defaultColor; return defaultColor;
} else if (role == Qt::CheckStateRole && index.column() >= Column::Debug } else if (index.column() >= Column::Debug && index.column() <= Column::Info) {
&& index.column() <= Column::Info) { if (role == Qt::CheckStateRole) {
const LoggingCategoryEntry &entry = m_categories.at(index.row()); const LoggingCategoryEntry &entry = m_categories.at(index.row());
return entry.isEnabled(static_cast<QtMsgType>(index.column() - Column::Debug)) const bool isEnabled = entry.isEnabled(
static_cast<QtMsgType>(index.column() - Column::Debug));
return isEnabled ? Qt::Checked : Qt::Unchecked;
} else if (role == OriginalStateRole) {
const LoggingCategoryEntry &entry = m_categories.at(index.row());
return entry.isEnabledOriginally(static_cast<QtMsgType>(index.column() - Column::Debug))
? Qt::Checked ? Qt::Checked
: Qt::Unchecked; : Qt::Unchecked;
} }
}
return {}; return {};
} }
@@ -609,9 +625,8 @@ LoggingViewManagerWidget::LoggingViewManagerWidget(QWidget *parent)
auto qtInternal = new QToolButton; auto qtInternal = new QToolButton;
qtInternal->setIcon(Core::Icons::QTLOGO.icon()); qtInternal->setIcon(Core::Icons::QTLOGO.icon());
qtInternal->setToolTip(Tr::tr("Toggle Qt Internal Logging")); qtInternal->setToolTip(Tr::tr("Filter Qt Internal Log Categories"));
qtInternal->setCheckable(true); qtInternal->setCheckable(false);
qtInternal->setChecked(false);
auto autoScroll = new QToolButton; auto autoScroll = new QToolButton;
autoScroll->setIcon(Utils::Icons::ARROW_DOWN.icon()); autoScroll->setIcon(Utils::Icons::ARROW_DOWN.icon());
@@ -663,27 +678,53 @@ LoggingViewManagerWidget::LoggingViewManagerWidget(QWidget *parent)
for (int i = LoggingCategoryModel::Column::Color; i < LoggingCategoryModel::Column::Info; i++) for (int i = LoggingCategoryModel::Column::Color; i < LoggingCategoryModel::Column::Info; i++)
m_categoryView->resizeColumnToContents(i); m_categoryView->resizeColumnToContents(i);
auto filterEdit = new Utils::FancyLineEdit;
filterEdit->setHistoryCompleter("LogFilterCompletionHistory");
filterEdit->setFiltering(true);
filterEdit->setPlaceholderText(Tr::tr("Filter categories by regular expression"));
filterEdit->setText("^(?!qt\\.).+");
filterEdit->setValidationFunction(
[](const QString &input) {
return Utils::asyncRun([input]() -> Utils::expected_str<QString> {
QRegularExpression re(input);
if (re.isValid())
return input;
return Utils::make_unexpected(
Tr::tr("Invalid regular expression: %1").arg(re.errorString()));
});
});
QSplitter *splitter{nullptr}; QSplitter *splitter{nullptr};
using namespace Layouting; using namespace Layouting;
// clang-format off // clang-format off
Column { Column {
Splitter {
bindTo(&splitter),
Column {
noMargin(),
Row { Row {
spacing(0), spacing(0),
save, save,
clean, clean,
m_stopLog, m_stopLog,
qtInternal,
autoScroll, autoScroll,
m_timestamps, m_timestamps,
m_messageTypes, m_messageTypes,
st, st,
}, },
Splitter { m_logView
bindTo(&splitter), },
m_logView, Column {
noMargin(),
Row {
qtInternal,
filterEdit,
},
m_categoryView, m_categoryView,
} }
}
}.attachTo(this); }.attachTo(this);
// clang-format on // clang-format on
@@ -746,12 +787,17 @@ LoggingViewManagerWidget::LoggingViewManagerWidget(QWidget *parent)
m_sortFilterModel->setFilterRegularExpression("^(?!qt\\.).+"); m_sortFilterModel->setFilterRegularExpression("^(?!qt\\.).+");
connect(qtInternal, &QToolButton::toggled, m_sortFilterModel, [this](bool checked) { connect(qtInternal, &QToolButton::clicked, filterEdit, [filterEdit] {
if (checked) { filterEdit->setText("^(?!qt\\.).+");
m_sortFilterModel->setFilterRegularExpression(""); });
} else {
m_sortFilterModel->setFilterRegularExpression("^(?!qt\\.).+"); connect(filterEdit,
} &Utils::FancyLineEdit::textChanged,
m_sortFilterModel,
[this](const QString &f) {
QRegularExpression re(f);
if (re.isValid())
m_sortFilterModel->setFilterRegularExpression(f);
}); });
connect(m_timestamps, &QToolButton::toggled, this, [this](bool checked) { connect(m_timestamps, &QToolButton::toggled, this, [this](bool checked) {
@@ -802,40 +848,70 @@ void LoggingViewManagerWidget::showLogCategoryContextMenu(const QPoint &pos) con
QMenu m; QMenu m;
auto uncheckAll = new QAction(Tr::tr("Uncheck All"), &m); auto uncheckAll = new QAction(Tr::tr("Uncheck All"), &m);
auto resetAll = new QAction(Tr::tr("Reset All"), &m);
int column = 0; auto isTypeColumn = [](int column) {
return column >= LoggingCategoryModel::Column::Debug
&& column <= LoggingCategoryModel::Column::Info;
};
if (idx.isValid()) { auto setChecked = [this](std::initializer_list<LoggingCategoryModel::Column> columns,
column = idx.column(); Qt::CheckState checked) {
if (column >= LoggingCategoryModel::Column::Debug for (int row = 0, count = m_sortFilterModel->rowCount(); row < count; ++row) {
&& column <= LoggingCategoryModel::Column::Info) { for (int column : columns) {
bool isChecked = idx.data(Qt::CheckStateRole).toBool(); m_sortFilterModel->setData(m_sortFilterModel->index(row, column),
checked,
Qt::CheckStateRole);
}
}
};
auto resetToOriginal = [this](std::initializer_list<LoggingCategoryModel::Column> columns) {
for (int row = 0, count = m_sortFilterModel->rowCount(); row < count; ++row) {
for (int column : columns) {
const QModelIndex id = m_sortFilterModel->index(row, column);
m_sortFilterModel->setData(id,
id.data(LoggingCategoryModel::OriginalStateRole),
Qt::CheckStateRole);
}
}
};
QString text = isChecked ? Tr::tr("Uncheck All %1") : Tr::tr("Check All %1"); if (idx.isValid() && isTypeColumn(idx.column())) {
const LoggingCategoryModel::Column column = static_cast<LoggingCategoryModel::Column>(
idx.column());
bool isChecked = idx.data(Qt::CheckStateRole).toInt() == Qt::Checked;
const QString uncheckText = isChecked ? Tr::tr("Uncheck All %1") : Tr::tr("Check All %1");
uncheckAll->setText(text.arg(messageTypeToString( uncheckAll->setText(uncheckText.arg(messageTypeToString(
static_cast<QtMsgType>(column - LoggingCategoryModel::Column::Debug)))); static_cast<QtMsgType>(column - LoggingCategoryModel::Column::Debug))));
resetAll->setText(Tr::tr("Reset All %1")
.arg(messageTypeToString(static_cast<QtMsgType>(
column - LoggingCategoryModel::Column::Debug))));
connect(uncheckAll, &QAction::triggered, m_sortFilterModel, [this, idx, isChecked] { Qt::CheckState newState = isChecked ? Qt::Unchecked : Qt::Checked;
for (int i = 0; i < m_sortFilterModel->rowCount(); ++i) {
m_sortFilterModel->setData(m_sortFilterModel->index(i, idx.column()), connect(uncheckAll,
!isChecked, &QAction::triggered,
Qt::CheckStateRole); m_sortFilterModel,
} [setChecked, column, newState]() { setChecked({column}, newState); });
connect(resetAll, &QAction::triggered, m_sortFilterModel, [resetToOriginal, column]() {
resetToOriginal({column});
}); });
} else { } else {
connect(uncheckAll, &QAction::triggered, m_sortFilterModel, [this] { // No need to add Fatal here, as it is read-only
for (int i = 0; i < m_sortFilterModel->rowCount(); ++i) { static auto allColumns = {LoggingCategoryModel::Column::Debug,
for (int c = LoggingCategoryModel::Column::Debug; LoggingCategoryModel::Column::Warning,
c <= LoggingCategoryModel::Column::Info; LoggingCategoryModel::Column::Critical,
++c) { LoggingCategoryModel::Column::Info};
m_sortFilterModel->setData(m_sortFilterModel->index(i, c),
false, connect(uncheckAll, &QAction::triggered, m_sortFilterModel, [setChecked]() {
Qt::CheckStateRole); setChecked(allColumns, Qt::Unchecked);
} });
} connect(resetAll, &QAction::triggered, m_sortFilterModel, [resetToOriginal]() {
resetToOriginal(allColumns);
}); });
}
} }
// minimal load/save - plugins could later provide presets on their own? // minimal load/save - plugins could later provide presets on their own?
@@ -844,6 +920,7 @@ void LoggingViewManagerWidget::showLogCategoryContextMenu(const QPoint &pos) con
auto loadPreset = new QAction(Tr::tr("Update from Preset..."), &m); auto loadPreset = new QAction(Tr::tr("Update from Preset..."), &m);
m.addAction(loadPreset); m.addAction(loadPreset);
m.addAction(uncheckAll); m.addAction(uncheckAll);
m.addAction(resetAll);
connect(savePreset, connect(savePreset,
&QAction::triggered, &QAction::triggered,
m_categoryModel, m_categoryModel,

View File

@@ -7,7 +7,6 @@
#include "coreplugintr.h" #include "coreplugintr.h"
#include "icontext.h" #include "icontext.h"
#include "icore.h" #include "icore.h"
#include "imode.h"
#include "inavigationwidgetfactory.h" #include "inavigationwidgetfactory.h"
#include "modemanager.h" #include "modemanager.h"
#include "navigationsubwidget.h" #include "navigationsubwidget.h"
@@ -297,7 +296,9 @@ static QIcon closeIconForSide(Side side, int itemCount)
: Utils::Icons::CLOSE_SPLIT_RIGHT.icon(); : Utils::Icons::CLOSE_SPLIT_RIGHT.icon();
} }
Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position, int factoryIndex) Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position,
int factoryIndex,
bool updateActivationsMap)
{ {
for (int pos = position + 1; pos < d->m_subWidgets.size(); ++pos) { for (int pos = position + 1; pos < d->m_subWidgets.size(); ++pos) {
Internal::NavigationSubWidget *nsw = d->m_subWidgets.at(pos); Internal::NavigationSubWidget *nsw = d->m_subWidgets.at(pos);
@@ -323,6 +324,7 @@ Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position, int
d->m_subWidgets.insert(position, nsw); d->m_subWidgets.insert(position, nsw);
d->m_subWidgets.at(0)->setCloseIcon(closeIconForSide(d->m_side, d->m_subWidgets.size())); d->m_subWidgets.at(0)->setCloseIcon(closeIconForSide(d->m_side, d->m_subWidgets.size()));
if (updateActivationsMap)
NavigationWidgetPrivate::updateActivationsMap(nsw->factory()->id(), {d->m_side, position}); NavigationWidgetPrivate::updateActivationsMap(nsw->factory()->id(), {d->m_side, position});
return nsw; return nsw;
} }
@@ -400,8 +402,11 @@ void NavigationWidget::saveSettings(QtcSettings *settings)
const auto keys = NavigationWidgetPrivate::s_activationsMap.keys(); const auto keys = NavigationWidgetPrivate::s_activationsMap.keys();
for (const auto &factoryId : keys) { for (const auto &factoryId : keys) {
const auto &info = NavigationWidgetPrivate::s_activationsMap[factoryId]; const auto &info = NavigationWidgetPrivate::s_activationsMap[factoryId];
const Utils::Key key = settingsKey(activationKey + factoryId.name());
if (info.side == d->m_side) if (info.side == d->m_side)
settings->setValue(settingsKey(activationKey + factoryId.name()), info.position); settings->setValue(key, info.position);
else
settings->remove(key);
} }
} }
@@ -434,7 +439,7 @@ void NavigationWidget::restoreSettings(QtcSettings *settings)
int index = factoryIndex(Id::fromString(id)); int index = factoryIndex(Id::fromString(id));
if (index >= 0) { if (index >= 0) {
// Only add if the id was actually found! // Only add if the id was actually found!
insertSubItem(position, index); insertSubItem(position, index, /*updateActivationsMap=*/false);
++position; ++position;
} else { } else {
restoreSplitterState = false; restoreSplitterState = false;
@@ -443,7 +448,9 @@ void NavigationWidget::restoreSettings(QtcSettings *settings)
if (d->m_subWidgets.isEmpty()) if (d->m_subWidgets.isEmpty())
// Make sure we have at least the projects widget or outline widget // Make sure we have at least the projects widget or outline widget
insertSubItem(0, qMax(0, factoryIndex(Id::fromString(defaultFirstView(d->m_side))))); insertSubItem(0,
qMax(0, factoryIndex(Id::fromString(defaultFirstView(d->m_side)))),
/*updateActivationsMap=*/false);
setShown(settings->value(settingsKey("Visible"), defaultVisible(d->m_side)).toBool()); setShown(settings->value(settingsKey("Visible"), defaultVisible(d->m_side)).toBool());

View File

@@ -97,7 +97,9 @@ protected:
private: private:
void closeSubWidget(Internal::NavigationSubWidget *subWidget); void closeSubWidget(Internal::NavigationSubWidget *subWidget);
void updateToggleText(); void updateToggleText();
Internal::NavigationSubWidget *insertSubItem(int position, int factoryIndex); Internal::NavigationSubWidget *insertSubItem(int position,
int factoryIndex,
bool updateActivationsMap = true);
int factoryIndex(Utils::Id id); int factoryIndex(Utils::Id id);
Utils::Key settingsKey(const Utils::Key &key) const; Utils::Key settingsKey(const Utils::Key &key) const;

View File

@@ -577,8 +577,9 @@ static void displayResults(SearchResult *search,
item.setStyle(colorStyleForUsageType(result.tags)); item.setStyle(colorStyleForUsageType(result.tags));
item.setUseTextEditorFont(true); item.setUseTextEditorFont(true);
if (search->supportsReplace()) { if (search->supportsReplace()) {
const Node * const node = ProjectTree::nodeForFile(result.path);
item.setSelectForReplacement(!ProjectManager::hasProjects() item.setSelectForReplacement(!ProjectManager::hasProjects()
|| ProjectManager::projectForFile(result.path)); || (node && !node->isGenerated()));
} }
search->addResult(item); search->addResult(item);

View File

@@ -132,7 +132,8 @@ QtCreatorIntegration::QtCreatorIntegration(QDesignerFormEditorInterface *core, Q
connect(this, &QtCreatorIntegration::propertyChanged, connect(this, &QtCreatorIntegration::propertyChanged,
this, [this](QDesignerFormWindowInterface *formWindow, const QString &name, this, [this](QDesignerFormWindowInterface *formWindow, const QString &name,
const QVariant &) { const QVariant &) {
if (name == "objectName") { qCDebug(log) << "got propertyChanged() signal" << name;
if (name.endsWith("Name")) {
if (const auto extraCompiler = d->extraCompilers.find(formWindow); if (const auto extraCompiler = d->extraCompilers.find(formWindow);
extraCompiler != d->extraCompilers.end()) { extraCompiler != d->extraCompilers.end()) {
(*extraCompiler)->unblock(); (*extraCompiler)->unblock();

View File

@@ -14,6 +14,8 @@
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/projecttree.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/mimeutils.h> #include <utils/mimeutils.h>
@@ -308,10 +310,10 @@ Utils::SearchResultItems generateSearchResultItems(
item.setFilePath(filePath); item.setFilePath(filePath);
item.setUseTextEditorFont(true); item.setUseTextEditorFont(true);
if (renaming && limitToProjects) { if (renaming && limitToProjects) {
const bool fileBelongsToProject = ProjectExplorer::ProjectManager::projectForFile( const ProjectExplorer::Node * const node
filePath); = ProjectExplorer::ProjectTree::nodeForFile(filePath);
item.setSelectForReplacement(fileBelongsToProject); item.setSelectForReplacement(node && !node->isGenerated());
if (fileBelongsToProject if (node
&& filePath.baseName().compare(oldSymbolName, Qt::CaseInsensitive) == 0) { && filePath.baseName().compare(oldSymbolName, Qt::CaseInsensitive) == 0) {
fileRenameCandidates << filePath; fileRenameCandidates << filePath;
} }

View File

@@ -7,6 +7,8 @@
#include "qmlprojectmanager_global.h" #include "qmlprojectmanager_global.h"
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <QPointer>
namespace QmlProjectManager { namespace QmlProjectManager {
class QmlProject; class QmlProject;

View File

@@ -427,7 +427,7 @@ void SshProcessInterface::emitStarted(qint64 processId)
void SshProcessInterface::killIfRunning() void SshProcessInterface::killIfRunning()
{ {
if (d->m_killed || d->m_process.state() != QProcess::Running) if (d->m_killed || d->m_process.state() != QProcess::Running || d->m_processId == 0)
return; return;
sendControlSignal(ControlSignal::Kill); sendControlSignal(ControlSignal::Kill);
d->m_killed = true; d->m_killed = true;
@@ -449,9 +449,12 @@ bool SshProcessInterface::runInShell(const CommandLine &command, const QByteArra
process.setCommand(cmd); process.setCommand(cmd);
process.setWriteData(data); process.setWriteData(data);
process.start(); process.start();
bool isFinished = process.waitForFinished(2000); // TODO: it may freeze on some devices bool isFinished = process.waitForFinished(2000); // It may freeze on some devices
// otherwise we may start producing killers for killers if (!isFinished) {
QTC_CHECK(isFinished); Core::MessageManager::writeFlashing(tr("Can't send control signal to the %1 device. "
"The device might have been disconnected.")
.arg(d->m_device->displayName()));
}
return isFinished; return isFinished;
} }

View File

@@ -7,6 +7,7 @@
#include <QDir> #include <QDir>
#include <QFileOpenEvent> #include <QFileOpenEvent>
#include <QLockFile> #include <QLockFile>
#include <QPointer>
#include <QSharedMemory> #include <QSharedMemory>
#include <QWidget> #include <QWidget>