Merge remote-tracking branch 'origin/12.0' into qds/dev

Change-Id: Ic6e557806a3209e2c6d983d3c3fcfad66f6e3066
This commit is contained in:
Tim Jenssen
2023-11-16 15:56:06 +01:00
45 changed files with 162 additions and 92 deletions

View File

@@ -123,7 +123,10 @@ else()
${YAML_SOURCE_DIR}/src/tag.h ${YAML_SOURCE_DIR}/src/tag.h
${YAML_SOURCE_DIR}/src/token.h ${YAML_SOURCE_DIR}/src/token.h
) )
if (NOT QTC_STATIC_BUILD) if (QTC_STATIC_BUILD)
extend_qtc_target(yaml-cpp
PUBLIC_DEFINES YAML_CPP_STATIC_DEFINE)
else()
extend_qtc_target(yaml-cpp extend_qtc_target(yaml-cpp
DEFINES yaml_cpp_EXPORTS DEFINES yaml_cpp_EXPORTS
PUBLIC_DEFINES YAML_CPP_DLL) PUBLIC_DEFINES YAML_CPP_DLL)

View File

@@ -211,9 +211,14 @@ function(add_qtc_library name)
) )
if (QTC_STATIC_BUILD) if (QTC_STATIC_BUILD)
extend_qtc_target(${name} PUBLIC_DEFINES ${EXPORT_SYMBOL}) extend_qtc_target(${name}
DEFINES ${EXPORT_SYMBOL}
PUBLIC_DEFINES ${EXPORT_SYMBOL})
else() else()
extend_qtc_target(${name} DEFINES ${EXPORT_SYMBOL}) extend_qtc_target(${name} DEFINES ${EXPORT_SYMBOL})
if (_arg_OBJECT OR _arg_STATIC)
extend_qtc_target(${name} PUBLIC_DEFINES ${EXPORT_SYMBOL})
endif()
endif() endif()
# everything is different with SOURCES_PREFIX # everything is different with SOURCES_PREFIX

View File

@@ -1,6 +1,6 @@
set(IDE_VERSION "11.0.84") # The IDE version. set(IDE_VERSION "12.0.0") # The IDE version.
set(IDE_VERSION_COMPAT "11.0.84") # The IDE Compatibility version. set(IDE_VERSION_COMPAT "12.0.0") # The IDE Compatibility version.
set(IDE_VERSION_DISPLAY "12.0.0-rc1") # The IDE display version. set(IDE_VERSION_DISPLAY "12.0.0") # The IDE display version.
set(IDE_COPYRIGHT_YEAR "2023") # The IDE current copyright year. set(IDE_COPYRIGHT_YEAR "2023") # The IDE current copyright year.
set(IDE_SETTINGSVARIANT "QtProject") # The IDE settings variation. set(IDE_SETTINGSVARIANT "QtProject") # The IDE settings variation.

View File

@@ -1,4 +1,4 @@
dependencies: dependencies:
../../qt/qt5.git: ../../qt/qt5.git:
ref: "6.5" ref: "6.6"

View File

@@ -170,7 +170,7 @@
\section2 Opening Sessions from Locator \section2 Opening Sessions from Locator
You can use the filter that triggers menu commands to open You can use the filter that triggers menu commands to open
\l{Managing Sessions}{sessions}. Enter \l{Manage sessions}{sessions}. Enter
\c {t yoursess} or \c {t sess yoursess} to trigger \uicontrol File > \c {t yoursess} or \c {t sess yoursess} to trigger \uicontrol File >
\uicontrol Sessions > \e <session_name>. \uicontrol Sessions > \e <session_name>.

View File

@@ -149,7 +149,7 @@
\image qtcreator-toggle-progress-bar.webp {Toggle Progress Details button} \image qtcreator-toggle-progress-bar.webp {Toggle Progress Details button}
By default, \QC runs one clangd process per project. If you have created By default, \QC runs one clangd process per project. If you have created
\l{Managing Sessions}{sessions} that have related projects, you can \l{Manage sessions}{sessions} that have related projects, you can
specify that the projects in the session should be managed by a single specify that the projects in the session should be managed by a single
clangd process. clangd process.

View File

@@ -197,15 +197,13 @@
\li -lastsession \li -lastsession
\li ProjectExplorer plugin: load the last session when \QC starts. \li ProjectExplorer plugin: load the last session when \QC starts.
Open the projects and files that were open when you last exited Open the projects and files that were open when you last exited
\QC. For more information about managing sessions, see \QC.
\l{Managing Sessions}.
\row \row
\li <session> \li <session>
\li ProjectExplorer plugin: load the given session when \QC starts. \li ProjectExplorer plugin: load the given session when \QC starts.
Open the projects and files that were open when you last exited Open the projects and files that were open when you last exited
\QC. For more information about managing sessions, see \QC.
\l{Managing Sessions}.
\endtable \endtable
@@ -225,5 +223,5 @@
You can also switch to a dark theme to customize the appearance of widgets, You can also switch to a dark theme to customize the appearance of widgets,
colors, and icons without using stylesheets. colors, and icons without using stylesheets.
\sa {Run Qt Creator from the command line} \sa {Run Qt Creator from the command line}, {Manage sessions}
*/ */

View File

@@ -173,7 +173,7 @@
To open a project that is located in a particular directory, you can To open a project that is located in a particular directory, you can
pass on the directory name as a command-line argument. \QC looks for pass on the directory name as a command-line argument. \QC looks for
a \l{Managing Sessions}{session} that matches the directory name and a \l{Manage sessions}{session} that matches the directory name and
loads it. Or it looks for a project file in the directory and opens it. loads it. Or it looks for a project file in the directory and opens it.
For example, on Windows: For example, on Windows:

View File

@@ -13,11 +13,13 @@
\previouspage creator-project-managing-workspaces.html \previouspage creator-project-managing-workspaces.html
\nextpage creator-keyboard-shortcuts.html \nextpage creator-keyboard-shortcuts.html
\else \else
\previouspage creator-sharing-project-settings.html \previouspage creator-how-tos.html
\nextpage creator-design-mode.html
\endif \endif
\title Managing Sessions \ingroup creator-how-to-use
\ingroup studio-how-to
\title Manage sessions
When you exit \QC, it stores a snapshot of your current workspace as a When you exit \QC, it stores a snapshot of your current workspace as a
\e session. To restore the session automatically when you start \QC, \e session. To restore the session automatically when you start \QC,
@@ -61,6 +63,8 @@
To save a session under a new name, select \uicontrol Clone. To save a session under a new name, select \uicontrol Clone.
\section1 Create new sessions
To create a new session: To create a new session:
\list 1 \list 1
@@ -76,9 +80,12 @@
\endlist \endlist
\section1 Open sessions
To switch between sessions, select \uicontrol {Open}. To switch between sessions, select \uicontrol {Open}.
\if defined(qtcreator) \if defined(qtcreator)
The \uicontrol Projects tab in the \uicontrol Welcome mode lists existing The \uicontrol Projects tab in the \uicontrol Welcome mode lists existing
sessions. To open a session, select it or press sessions. To open a session, select it or press
\key Ctrl+Alt+<number>, where \e <number> is the number of the session to \key Ctrl+Alt+<number>, where \e <number> is the number of the session to
@@ -96,7 +103,7 @@
When you start \QC from the command line, you can give the name of When you start \QC from the command line, you can give the name of
a session as an argument and \QC will start with this session. a session as an argument and \QC will start with this session.
For more information, see \l{Command-Line Options}. \sa {Command-Line Options}, {Searching with the Locator}
\endif \endif
*/ */

View File

@@ -111,7 +111,7 @@
You can add a library into a \e subdirs project. Use wizards to create the You can add a library into a \e subdirs project. Use wizards to create the
project and the library and to link the library against the project. project and the library and to link the library against the project.
\note This tutorial only applies when you select qmake as the the build \note This tutorial only applies when you select qmake as the build
system for the subdirs project. system for the subdirs project.
\section1 Creating a shared library \section1 Creating a shared library

View File

@@ -16,10 +16,6 @@
\image front-projects.png \image front-projects.png
You can share projects with other designers and developers across different
development platforms with a common tool for design, development, and
debugging.
\list \list
\li \l{Creating Projects} \li \l{Creating Projects}
@@ -42,14 +38,8 @@
configurations for \QC and your projects. You can modify configurations for \QC and your projects. You can modify
the settings in the \uicontrol Projects mode. the settings in the \uicontrol Projects mode.
\li \l{Managing Sessions}
Sessions store items such as open files, breakpoints, and evaluated
expressions, which you do not typically want to share across
platforms.
\endlist \endlist
\sa {Build Systems} \sa {Manage Projects}{How To: Manage Projects}, {Manage sessions},
{Build Systems}
*/ */

View File

@@ -46,6 +46,6 @@
\note You cannot use this view to specify subprojects for projects. \note You cannot use this view to specify subprojects for projects.
\sa {Add subprojects to projects}, {Managing Sessions} \sa {Add subprojects to projects}, {Manage sessions}
*/ */

View File

@@ -42,7 +42,6 @@
\li \l{Using Custom Output Parsers} \li \l{Using Custom Output Parsers}
\li \l{Sharing Project Settings} \li \l{Sharing Project Settings}
\endlist \endlist
\li \l{Managing Sessions}
\endlist \endlist
\li \l{Designing User Interfaces} \li \l{Designing User Interfaces}
\list \list

View File

@@ -53,7 +53,6 @@
\li \l{Creating Projects} \li \l{Creating Projects}
\li \l{Version Control Systems} \li \l{Version Control Systems}
\li \l{Configuring Projects} \li \l{Configuring Projects}
\li \l{Managing Sessions}
\endlist \endlist
\li \b {\l{Designing User Interfaces}} \li \b {\l{Designing User Interfaces}}
\list \list

View File

@@ -19,7 +19,7 @@
\if defined(qtcreator) \if defined(qtcreator)
The project tree has a list of all projects open in the current The project tree has a list of all projects open in the current
\l{Managing Sessions}{session}. For each project, the tree visualizes \l{Manage sessions}{session}. For each project, the tree visualizes
the build system structure of the project and lists all files that the build system structure of the project and lists all files that
are part of the project. are part of the project.

View File

@@ -36,7 +36,7 @@
\li \l{Qt Insight} \li \l{Qt Insight}
\endlist \endlist
\li \l{Managing Workspaces} \li \l{Managing Workspaces}
\li \l{Managing Sessions} \li \l{Manage sessions}
\li \l{Keyboard Shortcuts} \li \l{Keyboard Shortcuts}
\endlist \endlist
\li \l{Creating Projects} \li \l{Creating Projects}

View File

@@ -4,16 +4,16 @@ import qbs.FileInfo
import qbs.Utilities import qbs.Utilities
Module { Module {
property string qtcreator_display_version: '12.0.0-rc1' property string qtcreator_display_version: '12.0.0'
property string ide_version_major: '11' property string ide_version_major: '12'
property string ide_version_minor: '0' property string ide_version_minor: '0'
property string ide_version_release: '84' property string ide_version_release: '0'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.'
+ ide_version_release + ide_version_release
property string ide_compat_version_major: '11' property string ide_compat_version_major: '12'
property string ide_compat_version_minor: '0' property string ide_compat_version_minor: '0'
property string ide_compat_version_release: '84' property string ide_compat_version_release: '0'
property string qtcreator_compat_version: ide_compat_version_major + '.' property string qtcreator_compat_version: ide_compat_version_major + '.'
+ ide_compat_version_minor + '.' + ide_compat_version_release + ide_compat_version_minor + '.' + ide_compat_version_release

View File

@@ -1,6 +1,5 @@
add_qtc_library(Nanotrace add_qtc_library(Nanotrace
BUILD_DEFAULT OFF BUILD_DEFAULT OFF
DEFINES NANOTRACE_LIBRARY
PUBLIC_DEFINES NANOTRACE_ENABLED PUBLIC_DEFINES NANOTRACE_ENABLED
SOURCES SOURCES
nanotraceglobals.h nanotraceglobals.h

View File

@@ -1,7 +1,6 @@
add_qtc_library(Spinner OBJECT add_qtc_library(Spinner OBJECT
# Never add dependencies to non-Qt libraries for this library # Never add dependencies to non-Qt libraries for this library
DEPENDS Qt::Core Qt::Widgets DEPENDS Qt::Core Qt::Widgets
PUBLIC_DEFINES SPINNER_LIBRARY
SOURCES SOURCES
spinner.cpp spinner.h spinner.cpp spinner.h
spinner.qrc spinner.qrc

View File

@@ -1,7 +1,6 @@
add_qtc_library(Tasking OBJECT add_qtc_library(Tasking OBJECT
# Never add dependencies to non-Qt libraries for this library # Never add dependencies to non-Qt libraries for this library
DEPENDS Qt::Concurrent Qt::Core Qt::Network DEPENDS Qt::Concurrent Qt::Core Qt::Network
PUBLIC_DEFINES TASKING_LIBRARY
SOURCES SOURCES
barrier.cpp barrier.h barrier.cpp barrier.h
concurrentcall.h concurrentcall.h

View File

@@ -3,6 +3,8 @@ add_qtc_library(Utils
PUBLIC_DEPENDS PUBLIC_DEPENDS
Qt::Concurrent Qt::Core Qt::Network Qt::Gui Qt::Widgets Qt::Concurrent Qt::Core Qt::Network Qt::Gui Qt::Widgets
Qt::Core5Compat Qt::Core5Compat
$<$<BOOL:${QTC_STATIC_BUILD}>:Tasking>
$<$<BOOL:${QTC_STATIC_BUILD}>:Spinner>
SOURCES SOURCES
../3rdparty/span/span.hpp ../3rdparty/span/span.hpp
../3rdparty/tl_expected/include/tl/expected.hpp ../3rdparty/tl_expected/include/tl/expected.hpp

View File

@@ -12,7 +12,7 @@
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QVersionNumber> #include <QVersionNumber>
Q_LOGGING_CATEGORY(log, "terminal.externalprocess", QtWarningMsg) Q_LOGGING_CATEGORY(logTE, "terminal.externalprocess", QtWarningMsg)
namespace Utils { namespace Utils {
@@ -155,12 +155,12 @@ expected_str<qint64> ProcessStubCreator::startStubProcess(const ProcessSetupData
QObject::connect(process, &Process::readyReadStandardOutput, process, [process] { QObject::connect(process, &Process::readyReadStandardOutput, process, [process] {
const QString output = process->readAllStandardOutput(); const QString output = process->readAllStandardOutput();
if (!output.isEmpty()) if (!output.isEmpty())
qCWarning(log).noquote() << output; qCWarning(logTE).noquote() << output;
}); });
QObject::connect(process, &Process::readyReadStandardError, process, [process] { QObject::connect(process, &Process::readyReadStandardError, process, [process] {
const QString output = process->readAllStandardError(); const QString output = process->readAllStandardError();
if (!output.isEmpty()) if (!output.isEmpty())
qCCritical(log).noquote() << output; qCCritical(logTE).noquote() << output;
}); });
QObject::connect(process, &Process::done, m_interface, &TerminalInterface::onStubExited); QObject::connect(process, &Process::done, m_interface, &TerminalInterface::onStubExited);

View File

@@ -268,6 +268,7 @@ void InfoBarDisplay::update()
{ {
for (QWidget *widget : std::as_const(m_infoWidgets)) { for (QWidget *widget : std::as_const(m_infoWidgets)) {
widget->disconnect(this); // We want no destroyed() signal now widget->disconnect(this); // We want no destroyed() signal now
widget->hide(); // Late deletion can cause duplicate infos. Hide immediately to prevent it.
widget->deleteLater(); widget->deleteLater();
} }
m_infoWidgets.clear(); m_infoWidgets.clear();

View File

@@ -252,10 +252,8 @@ void ClangdFindReferences::Private::handleRenameRequest(
{ {
const Utils::FilePaths filePaths = BaseFileFind::replaceAll(newSymbolName, checkedItems, const Utils::FilePaths filePaths = BaseFileFind::replaceAll(newSymbolName, checkedItems,
preserveCase); preserveCase);
if (!filePaths.isEmpty()) { if (!filePaths.isEmpty())
DocumentManager::notifyFilesChangedInternally(filePaths);
SearchResultWindow::instance()->hide(); SearchResultWindow::instance()->hide();
}
const auto renameFilesCheckBox = qobject_cast<QCheckBox *>(search->additionalReplaceWidget()); const auto renameFilesCheckBox = qobject_cast<QCheckBox *>(search->additionalReplaceWidget());
QTC_ASSERT(renameFilesCheckBox, return); QTC_ASSERT(renameFilesCheckBox, return);

View File

@@ -478,6 +478,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
m_model.setPages(m_pages, IOptionsPageProvider::allOptionsPagesProviders()); m_model.setPages(m_pages, IOptionsPageProvider::allOptionsPagesProviders());
m_proxyModel.setSortLocaleAware(true);
m_proxyModel.setSourceModel(&m_model); m_proxyModel.setSourceModel(&m_model);
m_proxyModel.setFilterCaseSensitivity(Qt::CaseInsensitive); m_proxyModel.setFilterCaseSensitivity(Qt::CaseInsensitive);
m_categoryList->setIconSize(QSize(categoryIconSize, categoryIconSize)); m_categoryList->setIconSize(QSize(categoryIconSize, categoryIconSize));

View File

@@ -17,6 +17,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
#include <utils/fancylineedit.h> #include <utils/fancylineedit.h>
#include <utils/infolabel.h>
#include <QFrame> #include <QFrame>
#include <QLabel> #include <QLabel>
@@ -93,8 +94,6 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
topLayout->addWidget(m_topReplaceWidget); topLayout->addWidget(m_topReplaceWidget);
m_messageWidget = new QFrame; m_messageWidget = new QFrame;
pal.setColor(QPalette::WindowText, creatorTheme()->color(Theme::TextColorError));
m_messageWidget->setPalette(pal);
if (creatorTheme()->flag(Theme::DrawSearchResultWidgetFrame)) { if (creatorTheme()->flag(Theme::DrawSearchResultWidgetFrame)) {
m_messageWidget->setFrameStyle(QFrame::Panel | QFrame::Raised); m_messageWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
m_messageWidget->setLineWidth(1); m_messageWidget->setLineWidth(1);
@@ -103,8 +102,9 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
auto messageLayout = new QHBoxLayout(m_messageWidget); auto messageLayout = new QHBoxLayout(m_messageWidget);
messageLayout->setContentsMargins(2, 2, 2, 2); messageLayout->setContentsMargins(2, 2, 2, 2);
m_messageWidget->setLayout(messageLayout); m_messageWidget->setLayout(messageLayout);
m_messageLabel = new QLabel; m_messageLabel = new InfoLabel;
m_messageLabel->setPalette(pal); m_messageLabel->setType(InfoLabel::Error);
m_messageLabel->setFilled(true);
messageLayout->addWidget(m_messageLabel); messageLayout->addWidget(m_messageLabel);
layout->addWidget(m_messageWidget); layout->addWidget(m_messageWidget);
m_messageWidget->setVisible(false); m_messageWidget->setVisible(false);

View File

@@ -18,6 +18,7 @@ class QToolButton;
class QCheckBox; class QCheckBox;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Utils { class InfoLabel; }
namespace Core { namespace Core {
namespace Internal { namespace Internal {
@@ -123,7 +124,7 @@ private:
QWidget *m_descriptionContainer = nullptr; QWidget *m_descriptionContainer = nullptr;
QLabel *m_label = nullptr; QLabel *m_label = nullptr;
QLabel *m_searchTerm = nullptr; QLabel *m_searchTerm = nullptr;
QLabel *m_messageLabel = nullptr; Utils::InfoLabel *m_messageLabel = nullptr;
QToolButton *m_cancelButton = nullptr; QToolButton *m_cancelButton = nullptr;
QLabel *m_matchesFoundLabel = nullptr; QLabel *m_matchesFoundLabel = nullptr;
bool m_preserveCaseSupported = true; bool m_preserveCaseSupported = true;

View File

@@ -294,7 +294,7 @@ ClangdSettingsWidget::ClangdSettingsWidget(const ClangdSettings::Data &settingsD
d->autoIncludeHeadersCheckBox.setChecked(settings.autoIncludeHeaders()); d->autoIncludeHeadersCheckBox.setChecked(settings.autoIncludeHeaders());
d->autoIncludeHeadersCheckBox.setToolTip(autoIncludeToolTip); d->autoIncludeHeadersCheckBox.setToolTip(autoIncludeToolTip);
d->threadLimitSpinBox.setValue(settings.workerThreadLimit()); d->threadLimitSpinBox.setValue(settings.workerThreadLimit());
d->threadLimitSpinBox.setSpecialValueText("Automatic"); d->threadLimitSpinBox.setSpecialValueText(Tr::tr("Automatic"));
d->threadLimitSpinBox.setToolTip(workerThreadsToolTip); d->threadLimitSpinBox.setToolTip(workerThreadsToolTip);
d->documentUpdateThreshold.setMinimum(50); d->documentUpdateThreshold.setMinimum(50);
d->documentUpdateThreshold.setMaximum(10000); d->documentUpdateThreshold.setMaximum(10000);

View File

@@ -300,7 +300,7 @@ CppFileSettingsWidget::CppFileSettingsWidget(CppFileSettings *settings)
Column { Column {
Group { Group {
title("Headers"), title(Tr::tr("Headers")),
Form { Form {
Tr::tr("&Suffix:"), m_headerSuffixComboBox, st, br, Tr::tr("&Suffix:"), m_headerSuffixComboBox, st, br,
Tr::tr("S&earch paths:"), m_headerSearchPathsEdit, br, Tr::tr("S&earch paths:"), m_headerSearchPathsEdit, br,
@@ -309,7 +309,7 @@ CppFileSettingsWidget::CppFileSettingsWidget(CppFileSettings *settings)
} }
}, },
Group { Group {
title("Sources"), title(Tr::tr("Sources")),
Form { Form {
Tr::tr("S&uffix:"), m_sourceSuffixComboBox, st, br, Tr::tr("S&uffix:"), m_sourceSuffixComboBox, st, br,
Tr::tr("Se&arch paths:"), m_sourceSearchPathsEdit, br, Tr::tr("Se&arch paths:"), m_sourceSearchPathsEdit, br,

View File

@@ -9272,7 +9272,9 @@ template<typename T> inline T aFunction() { return T(); }
const QByteArrayList headersMemberDecl2Def{R"( const QByteArrayList headersMemberDecl2Def{R"(
class C { class C {
// Member function comment /**
* \brief Foo::aMember
*/
void @aMember(); void @aMember();
)", R"( )", R"(
class C { class C {
@@ -9285,7 +9287,9 @@ void C::aMember() {}
)", R"( )", R"(
#include "file.h" #include "file.h"
// Member function comment /**
* \brief Foo::aMember
*/
void C::aMember() {} void C::aMember() {}
)"}; )"};
QTest::newRow("member function: from decl to def") << headersMemberDecl2Def QTest::newRow("member function: from decl to def") << headersMemberDecl2Def
@@ -9296,13 +9300,17 @@ class C {
void aMember(); void aMember();
)", R"( )", R"(
class C { class C {
// Member function comment /**
* \brief Foo::aMember
*/
void aMember(); void aMember();
)"}; )"};
const QByteArrayList sourcesMemberDef2Decl{R"( const QByteArrayList sourcesMemberDef2Decl{R"(
#include "file.h" #include "file.h"
// Member function comment /**
* \brief Foo::aMember
*/
void C::aMember() {@} void C::aMember() {@}
)", R"( )", R"(
#include "file.h" #include "file.h"

View File

@@ -34,10 +34,13 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/editorconfiguration.h>
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
#include <projectexplorer/projecttree.h> #include <projectexplorer/projecttree.h>
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
#include <texteditor/tabsettings.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/layoutbuilder.h> #include <utils/layoutbuilder.h>
@@ -1950,25 +1953,30 @@ LookupResult lookUpDefinition(const CppQuickFixInterface &interface, const NameA
// Try to find the class/template definition // Try to find the class/template definition
const Name *name = nameAst->name; const Name *name = nameAst->name;
const QList<LookupItem> results = interface.context().lookup(name, scope); const QList<LookupItem> results = interface.context().lookup(name, scope);
LookupResult best = LookupResult::NotDeclared;
for (const LookupItem &item : results) { for (const LookupItem &item : results) {
if (Symbol *declaration = item.declaration()) { if (Symbol *declaration = item.declaration()) {
if (declaration->asClass()) if (declaration->asClass())
return LookupResult::Declared; return LookupResult::Declared;
if (declaration->asForwardClassDeclaration()) if (declaration->asForwardClassDeclaration()) {
return LookupResult::ForwardDeclared; best = LookupResult::ForwardDeclared;
continue;
}
if (Template *templ = declaration->asTemplate()) { if (Template *templ = declaration->asTemplate()) {
if (Symbol *declaration = templ->declaration()) { if (Symbol *declaration = templ->declaration()) {
if (declaration->asClass()) if (declaration->asClass())
return LookupResult::Declared; return LookupResult::Declared;
if (declaration->asForwardClassDeclaration()) if (declaration->asForwardClassDeclaration()) {
return LookupResult::ForwardDeclared; best = LookupResult::ForwardDeclared;
continue;
}
} }
} }
return LookupResult::Declared; return LookupResult::Declared;
} }
} }
return LookupResult::NotDeclared; return best;
} }
QString templateNameAsString(const TemplateNameId *templateName) QString templateNameAsString(const TemplateNameId *templateName)
@@ -9610,7 +9618,45 @@ private:
comments.first(), sourceFile->document()); comments.first(), sourceFile->document());
const int sourceCommentEndPos = sourceTu->getTokenEndPositionInDocument( const int sourceCommentEndPos = sourceTu->getTokenEndPositionInDocument(
comments.last(), sourceFile->document()); comments.last(), sourceFile->document());
const QString functionDoc = sourceFile->textOf(sourceCommentStartPos, sourceCommentEndPos);
// Manually adjust indentation, as both our built-in indenter and ClangFormat
// are unreliable with regards to comment continuation lines.
auto tabSettings = [](CppRefactoringFilePtr file) {
if (auto editor = file->editor())
return editor->textDocument()->tabSettings();
return ProjectExplorer::actualTabSettings(file->filePath(), nullptr);
};
const TabSettings &sts = tabSettings(sourceFile);
const TabSettings &tts = tabSettings(targetFile);
const QTextBlock insertionBlock = targetFile->document()->findBlock(insertionPos);
const int insertionColumn = tts.columnAt(insertionBlock.text(),
insertionPos - insertionBlock.position());
const QTextBlock removalBlock = sourceFile->document()->findBlock(sourceCommentStartPos);
const QTextBlock removalBlockEnd = sourceFile->document()->findBlock(sourceCommentEndPos);
const int removalColumn = sts.columnAt(removalBlock.text(),
sourceCommentStartPos - removalBlock.position());
const int columnOffset = insertionColumn - removalColumn;
QString functionDoc;
if (columnOffset != 0) {
for (QTextBlock block = removalBlock;
block.isValid() && block != removalBlockEnd.next();
block = block.next()) {
QString text = block.text() + QChar::ParagraphSeparator;
if (block == removalBlockEnd)
text = text.left(sourceCommentEndPos - block.position());
if (block == removalBlock) {
text = text.mid(sourceCommentStartPos - block.position());
} else {
int lineIndentColumn = sts.indentationColumn(text) + columnOffset;
text.replace(0,
TabSettings::firstNonSpace(text),
tts.indentationString(0, lineIndentColumn, 0, insertionBlock));
}
functionDoc += text;
}
} else {
functionDoc = sourceFile->textOf(sourceCommentStartPos, sourceCommentEndPos);
}
// Remove comment plus leading and trailing whitespace, including trailing newline. // Remove comment plus leading and trailing whitespace, including trailing newline.
const auto removeAtSource = [&](ChangeSet &changeSet) { const auto removeAtSource = [&](ChangeSet &changeSet) {
@@ -9642,10 +9688,10 @@ private:
ChangeSet targetChangeSet; ChangeSet targetChangeSet;
targetChangeSet.insert(insertionPos, functionDoc); targetChangeSet.insert(insertionPos, functionDoc);
targetChangeSet.insert(insertionPos, "\n"); targetChangeSet.insert(insertionPos, "\n");
targetChangeSet.insert(insertionPos, QString(insertionColumn, ' '));
if (targetFile == sourceFile) if (targetFile == sourceFile)
removeAtSource(targetChangeSet); removeAtSource(targetChangeSet);
targetFile->setChangeSet(targetChangeSet); targetFile->setChangeSet(targetChangeSet);
targetFile->appendIndentRange({insertionPos, insertionPos + int(functionDoc.length())});
const bool targetFileSuccess = targetFile->apply(); const bool targetFileSuccess = targetFile->apply();
if (targetFile == sourceFile || !targetFileSuccess) if (targetFile == sourceFile || !targetFileSuccess)
return; return;

View File

@@ -1661,6 +1661,7 @@ void Client::setLogTarget(LogTarget target)
void Client::start() void Client::start()
{ {
d->m_shutdownTimer.stop();
LanguageClientManager::addClient(this); LanguageClientManager::addClient(this);
d->m_clientInterface->start(); d->m_clientInterface->start();
} }

View File

@@ -691,13 +691,10 @@ void SymbolSupport::handleRenameResponse(Core::SearchResult *search,
void SymbolSupport::applyRename(const Utils::SearchResultItems &checkedItems, void SymbolSupport::applyRename(const Utils::SearchResultItems &checkedItems,
Core::SearchResult *search) Core::SearchResult *search)
{ {
QSet<Utils::FilePath> affectedNonOpenFilePaths;
QMap<Utils::FilePath, QList<TextEdit>> editsForDocuments; QMap<Utils::FilePath, QList<TextEdit>> editsForDocuments;
QList<DocumentChange> changes; QList<DocumentChange> changes;
for (const Utils::SearchResultItem &item : checkedItems) { for (const Utils::SearchResultItem &item : checkedItems) {
const auto filePath = Utils::FilePath::fromUserInput(item.path().value(0)); const auto filePath = Utils::FilePath::fromUserInput(item.path().value(0));
if (!m_client->documentForFilePath(filePath))
affectedNonOpenFilePaths << filePath;
const QJsonObject jsonObject = item.userData().toJsonObject(); const QJsonObject jsonObject = item.userData().toJsonObject();
if (const TextEdit edit(jsonObject); edit.isValid()) if (const TextEdit edit(jsonObject); edit.isValid())
editsForDocuments[filePath] << edit; editsForDocuments[filePath] << edit;
@@ -715,10 +712,6 @@ void SymbolSupport::applyRename(const Utils::SearchResultItems &checkedItems,
for (auto it = editsForDocuments.begin(), end = editsForDocuments.end(); it != end; ++it) for (auto it = editsForDocuments.begin(), end = editsForDocuments.end(); it != end; ++it)
applyTextEdits(m_client, it.key(), it.value()); applyTextEdits(m_client, it.key(), it.value());
if (!affectedNonOpenFilePaths.isEmpty()) {
Core::DocumentManager::notifyFilesChangedInternally(Utils::toList(affectedNonOpenFilePaths));
}
const auto extraWidget = qobject_cast<ReplaceWidget *>(search->additionalReplaceWidget()); const auto extraWidget = qobject_cast<ReplaceWidget *>(search->additionalReplaceWidget());
QTC_ASSERT(extraWidget, return); QTC_ASSERT(extraWidget, return);
if (!extraWidget->shouldRenameFiles()) if (!extraWidget->shouldRenameFiles())

View File

@@ -1,6 +1,7 @@
extend_qtc_plugin(McuSupport extend_qtc_plugin(McuSupport
CONDITION WITH_TESTS AND TARGET Googletest CONDITION WITH_TESTS AND TARGET Googletest
DEPENDS Googletest DEPENDS Googletest
DEFINES GOOGLE_TEST_IS_FOUND
SOURCES SOURCES
unittest.h unittest.cpp unittest.h unittest.cpp
packagemock.h packagemock.h

View File

@@ -821,7 +821,11 @@ void Project::createTargetFromMap(const Store &map, int index)
} }
Kit *k = KitManager::kit(id); Kit *k = KitManager::kit(id);
if (!k && !ICore::isQtDesignStudio()) { if (!k) {
// QDS does not want replacement kits.
if (ICore::isQtDesignStudio())
return;
Id deviceTypeId = Id::fromSetting(targetMap.value(Target::deviceTypeKey())); Id deviceTypeId = Id::fromSetting(targetMap.value(Target::deviceTypeKey()));
if (!deviceTypeId.isValid()) if (!deviceTypeId.isValid())
deviceTypeId = Constants::DESKTOP_DEVICE_TYPE; deviceTypeId = Constants::DESKTOP_DEVICE_TYPE;

View File

@@ -32,8 +32,6 @@ add_feature_info("Model tracing" ${ENABLE_MODEL_TRACING} "")
add_qtc_library(QmlDesignerUtils STATIC add_qtc_library(QmlDesignerUtils STATIC
DEPENDS DEPENDS
Qt::Gui Utils Qt::QmlPrivate Core Qt::Gui Utils Qt::QmlPrivate Core
DEFINES QMLDESIGNERUTILS_LIBRARY
PUBLIC_DEFINES $<$<BOOL:${QTC_STATIC_BUILD}>:QMLDESIGNER_STATIC_LIBRARY>
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/utils PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/utils
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/utils SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/utils
@@ -83,8 +81,6 @@ add_qtc_library(QmlDesignerCore STATIC
TextEditor TextEditor
Sqlite Sqlite
DEFINES DEFINES
QMLDESIGNERCORE_LIBRARY
QMLDESIGNERUTILS_LIBRARY
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE> $<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
INCLUDES INCLUDES
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
@@ -490,7 +486,6 @@ add_qtc_plugin(QmlDesigner
IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\" IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\"
SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner" SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner"
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE> $<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
QMLDESIGNER_LIBRARY QMLDESIGNERCORE_LIBRARY QMLDESIGNERUTILS_LIBRARY
INCLUDES INCLUDES
${CMAKE_CURRENT_LIST_DIR}/components ${CMAKE_CURRENT_LIST_DIR}/components
${CMAKE_CURRENT_LIST_DIR}/components/assetslibrary ${CMAKE_CURRENT_LIST_DIR}/components/assetslibrary

View File

@@ -7,6 +7,8 @@
#if defined(STUDIOWELCOME_LIBRARY) #if defined(STUDIOWELCOME_LIBRARY)
# define STUDIOWELCOME_EXPORT Q_DECL_EXPORT # define STUDIOWELCOME_EXPORT Q_DECL_EXPORT
#elif defined(STUDIOWELCOME_STATIC_LIBRARY)
# define STUDIOWELCOME_EXPORT
#else #else
# define STUDIOWELCOME_EXPORT Q_DECL_IMPORT # define STUDIOWELCOME_EXPORT Q_DECL_IMPORT
#endif #endif

View File

@@ -15,5 +15,6 @@ constexpr char CLEARSELECTION[] = "Terminal.ClearSelection";
constexpr char MOVECURSORWORDLEFT[] = "Terminal.MoveCursorWordLeft"; constexpr char MOVECURSORWORDLEFT[] = "Terminal.MoveCursorWordLeft";
constexpr char MOVECURSORWORDRIGHT[] = "Terminal.MoveCursorWordRight"; constexpr char MOVECURSORWORDRIGHT[] = "Terminal.MoveCursorWordRight";
constexpr char CLEAR_TERMINAL[] = "Terminal.ClearTerminal"; constexpr char CLEAR_TERMINAL[] = "Terminal.ClearTerminal";
constexpr char TOGGLE_KEYBOARD_LOCK[] = "Terminal.ToggleKeyboardLock";
} // namespace Terminal::Constants } // namespace Terminal::Constants

View File

@@ -125,6 +125,8 @@ TerminalPane::TerminalPane(QObject *parent)
updateLockButton(); updateLockButton();
connect(&toggleKeyboardLock, &QAction::triggered, m_lockKeyboardButton, &QToolButton::toggle);
connect(m_lockKeyboardButton, &QToolButton::toggled, this, [this, updateLockButton] { connect(m_lockKeyboardButton, &QToolButton::toggled, this, [this, updateLockButton] {
settings().lockKeyboard.setValue(m_lockKeyboardButton->isChecked()); settings().lockKeyboard.setValue(m_lockKeyboardButton->isChecked());
updateLockButton(); updateLockButton();
@@ -292,6 +294,8 @@ void TerminalPane::initActions()
closeTerminal.setIcon(CLOSE_TERMINAL_ICON.icon()); closeTerminal.setIcon(CLOSE_TERMINAL_ICON.icon());
closeTerminal.setToolTip(Tr::tr("Close the current Terminal.")); closeTerminal.setToolTip(Tr::tr("Close the current Terminal."));
toggleKeyboardLock.setText(Tr::tr("Toggle Keyboard Lock"));
using namespace Constants; using namespace Constants;
Command *cmd = ActionManager::registerAction(&newTerminal, NEWTERMINAL, m_selfContext); Command *cmd = ActionManager::registerAction(&newTerminal, NEWTERMINAL, m_selfContext);
@@ -310,6 +314,10 @@ void TerminalPane::initActions()
QKeySequence(HostOsInfo::isMacHost() ? QLatin1String("Ctrl+Shift+]") QKeySequence(HostOsInfo::isMacHost() ? QLatin1String("Ctrl+Shift+]")
: QLatin1String("Ctrl+PgDown"))}); : QLatin1String("Ctrl+PgDown"))});
ActionManager::registerAction(&toggleKeyboardLock,
TOGGLE_KEYBOARD_LOCK,
m_selfContext);
connect(&newTerminal, &QAction::triggered, this, [this] { openTerminal({}); }); connect(&newTerminal, &QAction::triggered, this, [this] { openTerminal({}); });
connect(&closeTerminal, &QAction::triggered, this, [this] { connect(&closeTerminal, &QAction::triggered, this, [this] {
removeTab(m_tabWidget.currentIndex()); removeTab(m_tabWidget.currentIndex());

View File

@@ -66,6 +66,7 @@ private:
QAction nextTerminal; QAction nextTerminal;
QAction prevTerminal; QAction prevTerminal;
QAction closeTerminal; QAction closeTerminal;
QAction toggleKeyboardLock;
QMenu m_shellMenu; QMenu m_shellMenu;

View File

@@ -293,7 +293,11 @@ void TerminalWidget::setupActions()
this, this,
&TerminalWidget::moveCursorWordRight); &TerminalWidget::moveCursorWordRight);
unlockGlobalAction(Core::Constants::EXIT); // Ctrl+Q, the default "Quit" shortcut, is a useful key combination in a shell.
// It can be used in combination with Ctrl+S to pause a program, and resume it with Ctrl+Q.
// So we unlock the EXIT command only for macOS where the default is Cmd+Q to quit.
if (HostOsInfo::isMacHost())
unlockGlobalAction(Core::Constants::EXIT);
unlockGlobalAction(Core::Constants::OPTIONS); unlockGlobalAction(Core::Constants::OPTIONS);
unlockGlobalAction("Preferences.Terminal.General"); unlockGlobalAction("Preferences.Terminal.General");
unlockGlobalAction(Core::Constants::FIND_IN_DOCUMENT); unlockGlobalAction(Core::Constants::FIND_IN_DOCUMENT);
@@ -571,6 +575,12 @@ bool TerminalWidget::event(QEvent *event)
return true; return true;
} }
if (settings().lockKeyboard()
&& QKeySequence(keyEvent->keyCombination())
== ActionManager::command(Constants::TOGGLE_KEYBOARD_LOCK)->keySequence()) {
return false;
}
if (settings().lockKeyboard()) { if (settings().lockKeyboard()) {
event->accept(); event->accept();
return true; return true;

View File

@@ -388,7 +388,6 @@ void BaseFileFind::doReplace(const QString &text, const SearchResultItems &items
if (!files.isEmpty()) { if (!files.isEmpty()) {
FadingIndicator::showText(ICore::dialogParent(), FadingIndicator::showText(ICore::dialogParent(),
Tr::tr("%n occurrences replaced.", nullptr, items.size()), FadingIndicator::SmallText); Tr::tr("%n occurrences replaced.", nullptr, items.size()), FadingIndicator::SmallText);
DocumentManager::notifyFilesChangedInternally(files);
SearchResultWindow::instance()->hide(); SearchResultWindow::instance()->hide();
} }
} }

View File

@@ -355,9 +355,9 @@ bool RefactoringFile::apply()
QString error; QString error;
// suppress "file has changed" warnings if the file is open in a read-only editor // suppress "file has changed" warnings if the file is open in a read-only editor
Core::FileChangeBlocker block(m_filePath); Core::FileChangeBlocker block(m_filePath);
if (!m_textFileFormat.writeFile(m_filePath, if (m_textFileFormat.writeFile(m_filePath, doc->toPlainText(), &error)) {
doc->toPlainText(), Core::DocumentManager::notifyFilesChangedInternally({m_filePath});
&error)) { } else {
qWarning() << "Could not apply changes to" << m_filePath qWarning() << "Could not apply changes to" << m_filePath
<< ". Error: " << error; << ". Error: " << error;
result = false; result = false;

View File

@@ -157,7 +157,7 @@ public:
, m_editor(parent) , m_editor(parent)
{ {
connect(m_editor, &QPlainTextEdit::cursorPositionChanged, this, &LineColumnButton::update); connect(m_editor, &QPlainTextEdit::cursorPositionChanged, this, &LineColumnButton::update);
connect(this, &QToolButton::pressed, ActionManager::instance(), [this] { connect(this, &QToolButton::clicked, ActionManager::instance(), [this] {
emit m_editor->activateEditor(EditorManager::IgnoreNavigationHistory); emit m_editor->activateEditor(EditorManager::IgnoreNavigationHistory);
QMetaObject::invokeMethod(ActionManager::instance(), [] { QMetaObject::invokeMethod(ActionManager::instance(), [] {
if (Command *cmd = ActionManager::command(Core::Constants::GOTO)) { if (Command *cmd = ActionManager::command(Core::Constants::GOTO)) {

View File

@@ -50,8 +50,8 @@ void tst_Reformatter::test_data()
// makes a change inline, for example whitespace removal. We omit // makes a change inline, for example whitespace removal. We omit
// those files in this test. // those files in this test.
QSet<QString> excludedFiles; QSet<QString> excludedFiles;
excludedFiles << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.qml"; excludedFiles << QString::fromLatin1(TESTSRCDIR) + "/typeAnnotations.qml";
excludedFiles << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.formatted.qml"; excludedFiles << QString::fromLatin1(TESTSRCDIR) + "/typeAnnotations.formatted.qml";
QDirIterator it(TESTSRCDIR, QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"), QDir::Files); QDirIterator it(TESTSRCDIR, QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"), QDir::Files);
while (it.hasNext()) { while (it.hasNext()) {
@@ -103,8 +103,8 @@ void tst_Reformatter::reformatter_data()
QTest::addColumn<QString>("formattedFilePath"); QTest::addColumn<QString>("formattedFilePath");
QTest::newRow("typeAnnotations") QTest::newRow("typeAnnotations")
<< QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.qml" << QString::fromLatin1(TESTSRCDIR) + "/typeAnnotations.qml"
<< QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.formatted.qml"; << QString::fromLatin1(TESTSRCDIR) +"/typeAnnotations.formatted.qml";
} }
void tst_Reformatter::reformatter() void tst_Reformatter::reformatter()