Merge remote-tracking branch 'origin/14.0'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	src/libs/solutions/tasking/tasktree.cpp
	src/plugins/coreplugin/imode.cpp
	src/plugins/cppeditor/cpphighlighter.cpp

Change-Id: I5114911d18e377076c5c07b27d6ca918774f34b9
This commit is contained in:
Eike Ziller
2024-08-07 10:20:08 +02:00
43 changed files with 311 additions and 81 deletions

View File

@@ -500,7 +500,7 @@ static QList<LinkWithColumns> linksForIssue(const std::map<QString, Dto::Any> &i
const QString &line) {
QList<int> columns;
auto it = issueRow.find(path);
if (it != end) {
if (it != end && !it->second.isNull()) {
Link link{ FilePath::fromUserInput(it->second.getString()) };
columns.append(findColumn(it->first));
it = issueRow.find(line);

View File

@@ -617,10 +617,10 @@ void CMakeBuildSettingsWidget::reconfigureWithInitialParameters()
if (reply != QMessageBox::Yes)
return;
m_buildConfig->cmakeBuildSystem()->clearCMakeCache();
updateInitialCMakeArguments();
m_buildConfig->cmakeBuildSystem()->clearCMakeCache();
if (ProjectExplorerPlugin::saveModifiedFiles())
m_buildConfig->cmakeBuildSystem()->runCMake();
}

View File

@@ -1240,6 +1240,11 @@ void CMakeBuildSystem::clearCMakeCache()
path.removeRecursively();
emit configurationCleared();
}
void CMakeBuildSystem::disableCMakeBuildMenuActions()
{
emitParsingStarted();
emitParsingFinished(false);
}

View File

@@ -77,6 +77,7 @@ public:
bool persistCMakeState();
void clearCMakeCache();
void disableCMakeBuildMenuActions();
// Context menu actions:
void buildCMakeTarget(const QString &buildTarget);

View File

@@ -263,6 +263,7 @@ void CMakeManager::clearCMakeCache(BuildSystem *buildSystem)
QTC_ASSERT(cmakeBuildSystem, return);
cmakeBuildSystem->clearCMakeCache();
cmakeBuildSystem->disableCMakeBuildMenuActions();
}
void CMakeManager::runCMake(BuildSystem *buildSystem)

View File

@@ -129,7 +129,7 @@ using namespace Internal;
* name.
*/
/*! \enum ReadOnlyFilesDialog::ReadOnlyResult
/*! \enum Core::ReadOnlyFilesDialog::ReadOnlyResult
This enum holds the operations that are allowed to make the file writable.
\value RO_Cancel

View File

@@ -208,7 +208,7 @@ void EditorManagerPlaceHolder::showEvent(QShowEvent *)
*/
/*!
\enum EditorManager::OpenEditorFlag
\enum Core::EditorManager::OpenEditorFlag
This enum specifies settings for opening a file in an editor.

View File

@@ -72,7 +72,7 @@
*/
/*!
\enum IDocument::OpenResult
\enum Core::IDocument::OpenResult
The OpenResult enum describes whether a file was successfully opened.
@@ -87,13 +87,13 @@
*/
/*!
\enum IDocument::ReloadSetting
\enum Core::IDocument::ReloadSetting
\internal
*/
/*!
\enum IDocument::ChangeTrigger
\enum Core::IDocument::ChangeTrigger
The ChangeTrigger enum describes whether a file was changed from \QC
internally or from the outside.
@@ -107,7 +107,7 @@
*/
/*!
\enum IDocument::ChangeType
\enum Core::IDocument::ChangeType
The ChangeType enum describes the way in which the file changed.
@@ -121,7 +121,7 @@
*/
/*!
\enum IDocument::ReloadFlag
\enum Core::IDocument::ReloadFlag
The ReloadFlag enum describes if a file should be reloaded from disk.

View File

@@ -74,7 +74,7 @@ public:
*/
/*!
\property IMode::enabled
\property Core::IMode::enabled
This property holds whether the mode is enabled.
@@ -82,7 +82,7 @@ public:
*/
/*!
\property IMode::displayName
\property Core::IMode::displayName
This property holds the display name of the mode.
@@ -90,7 +90,7 @@ public:
*/
/*!
\property IMode::icon
\property Core::IMode::icon
This property holds the icon of the mode.
@@ -99,7 +99,7 @@ public:
*/
/*!
\property IMode::priority
\property Core::IMode::priority
This property holds the priority of the mode.
@@ -110,7 +110,7 @@ public:
*/
/*!
\property IMode::id
\property Core::IMode::id
This property holds the ID of the mode.
*/

View File

@@ -17,7 +17,7 @@ namespace Core {
*/
/*!
\enum IOutputPane::Flag
\enum Core::IOutputPane::Flag
This enum type controls the behavior of the output pane when it is requested to show itself.

View File

@@ -884,7 +884,8 @@ void ILocatorFilter::setConfigurable(bool configurable)
/*!
Shows the standard configuration dialog with options for the prefix string
and for isIncludedByDefault(). The \a additionalWidget is added at the top.
and for isIncludedByDefault(). \a parent is used as the dialog's parent.
The \a additionalWidget is added at the top.
Ownership of \a additionalWidget stays with the caller, but its parent is
reset to \c nullptr.

View File

@@ -472,6 +472,9 @@ void CppHighlighter::highlightStringLiteral(QStringView text, const CPlusPlus::T
case T_UTF8_STRING_LITERAL:
case T_UTF16_STRING_LITERAL:
case T_UTF32_STRING_LITERAL:
case T_WIDE_CHAR_LITERAL:
case T_UTF16_CHAR_LITERAL:
case T_UTF32_CHAR_LITERAL:
break;
default:
if (!tk.userDefinedLiteral()) { // Simple case: No prefix, no suffix.
@@ -481,16 +484,17 @@ void CppHighlighter::highlightStringLiteral(QStringView text, const CPlusPlus::T
}
}
const char quote = tk.isStringLiteral() ? '"' : '\'';
int stringOffset = 0;
if (!tk.f.joined) {
stringOffset = text.indexOf('"', tk.utf16charsBegin());
stringOffset = text.indexOf(quote, tk.utf16charsBegin());
QTC_ASSERT(stringOffset > 0, return);
setFormat(tk.utf16charsBegin(), stringOffset - tk.utf16charsBegin(),
formatForCategory(C_KEYWORD));
}
int operatorOffset = tk.utf16charsBegin() + tk.utf16chars();
if (tk.userDefinedLiteral()) {
const int closingQuoteOffset = text.lastIndexOf('"', operatorOffset);
const int closingQuoteOffset = text.lastIndexOf(quote, operatorOffset);
QTC_ASSERT(closingQuoteOffset >= tk.utf16charsBegin(), return);
operatorOffset = closingQuoteOffset + 1;
}
@@ -498,7 +502,10 @@ void CppHighlighter::highlightStringLiteral(QStringView text, const CPlusPlus::T
formatForCategory(C_STRING));
if (const int operatorLength = tk.utf16charsBegin() + tk.utf16chars() - operatorOffset;
operatorLength > 0) {
setFormat(operatorOffset, operatorLength, formatForCategory(C_OPERATOR));
setFormat(
operatorOffset,
operatorLength,
formatForCategory(tk.userDefinedLiteral() ? C_OVERLOADED_OPERATOR : C_OPERATOR));
}
}
@@ -627,6 +634,12 @@ private slots:
<< 49 << 1 << 49 << 1 << C_STRING;
QTest::newRow("multi-line raw string literal with consecutive closing parens (suffix)")
<< 49 << 2 << 49 << 3 << C_KEYWORD;
QTest::newRow("wide char literal with user-defined suffix (prefix)")
<< 73 << 16 << 73 << 16 << C_KEYWORD;
QTest::newRow("wide char literal with user-defined suffix (content)")
<< 73 << 17 << 73 << 18 << C_STRING;
QTest::newRow("wide char literal with user-defined suffix (suffix)")
<< 73 << 20 << 73 << 22 << C_OVERLOADED_OPERATOR;
}
void test()

View File

@@ -68,3 +68,6 @@ static void parenTest2()
}
}
wchar_t operator ""_wc(const wchar_t c) { return c; }
const auto c = L'c'_wc;

View File

@@ -185,6 +185,7 @@ void TypeHierarchyBuilder::buildDerived(const std::optional<QFuture<void>> &futu
return;
Document::Ptr doc = snapshot.document(fileName);
if ((_candidates.contains(fileName) && !_candidates.value(fileName).contains(symbolName))
|| !symbol->identifier()
|| !doc->control()->findIdentifier(symbol->identifier()->chars(),
symbol->identifier()->size())) {
continue;

View File

@@ -1827,6 +1827,7 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
menu->addAction(s.settingsDialog.action());
// useDebuggingHelpers/useDynamicType have no auto-apply, but need to be persisted on triggered
connect(this, &WatchModel::dataChanged, menu, &QMenu::close);
connect(debugHelperAction, &QAction::triggered,
&s.useDebuggingHelpers, &BoolAspect::writeSettings, Qt::UniqueConnection);
connect(dynamicTypeAction, &QAction::triggered,

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formwindowfile.h"
#include "qtcreatorintegration.h"
#include "designerconstants.h"
#include "resourcehandler.h"
@@ -230,6 +231,10 @@ bool FormWindowFile::writeFile(const Utils::FilePath &filePath, QString *errorSt
{
if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << this->filePath() << filePath;
auto *integration = qobject_cast<QtCreatorIntegration *>(m_formWindow->core()->integration());
Q_ASSERT(integration);
if (!integration->setQtVersionFromFile(filePath))
integration->resetQtVersion();
return write(filePath, format(), m_formWindow->contents(), errorString);
}

View File

@@ -37,6 +37,8 @@
#include <texteditor/texteditor.h>
#include <texteditor/textdocument.h>
#include <qtsupport/qtkitaspect.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/mimeutils.h>
@@ -45,16 +47,20 @@
#include <utils/temporaryfile.h>
#include <QDesignerFormWindowInterface>
#include <QDesignerFormWindowManagerInterface>
#include <QDesignerFormEditorInterface>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QLibraryInfo>
#include <QLoggingCategory>
#include <QMessageBox>
#include <QHash>
#include <QVersionNumber>
#include <QUrl>
#include <memory>
#include <optional>
Q_LOGGING_CATEGORY(log, "qtc.designer", QtWarningMsg);
@@ -84,6 +90,17 @@ static void reportRenamingError(const QString &oldName, const QString &reason)
.arg(oldName, reason));
}
static std::optional<QVersionNumber> qtVersionFromProject(const Project *project)
{
if (const auto *target = project->activeTarget()) {
if (const auto *kit = target->kit(); kit->isValid()) {
if (const auto *qtVersion = QtSupport::QtKitAspect::qtVersion(kit))
return qtVersion->qtVersion();
}
}
return std::nullopt;
}
class QtCreatorIntegration::Private
{
public:
@@ -143,6 +160,10 @@ QtCreatorIntegration::QtCreatorIntegration(QDesignerFormEditorInterface *core, Q
}
}
});
auto *fwm = core->formWindowManager();
connect(fwm, &QDesignerFormWindowManagerInterface::activeFormWindowChanged,
this, &QtCreatorIntegration::slotActiveFormWindowChanged);
}
QtCreatorIntegration::~QtCreatorIntegration()
@@ -433,6 +454,40 @@ static ClassDocumentPtrPair
return ClassDocumentPtrPair(0, Document::Ptr());
}
void QtCreatorIntegration::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow)
{
if (formWindow == nullptr
|| !setQtVersionFromFile(Utils::FilePath::fromString(formWindow->fileName()))) {
resetQtVersion();
}
}
// Set the file's Qt version on the integration for Qt Designer to write
// it out in the appropriate format (PYSIDE-2492, scoped enum support).
bool QtCreatorIntegration::setQtVersionFromFile(const Utils::FilePath &filePath)
{
if (const auto *uiProject = ProjectManager::projectForFile(filePath)) {
if (auto versionOpt = qtVersionFromProject(uiProject)) {
setQtVersion(versionOpt.value());
return true;
}
}
return false;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
// FIXME: To be replaced by a real property setter on QDesignerIntegration
void QtCreatorIntegration::setQtVersion(const QVersionNumber &version)
{
setProperty("qtVersion", QVariant::fromValue(version));
}
#endif // < 6.9
void QtCreatorIntegration::resetQtVersion()
{
setQtVersion(QLibraryInfo::version());
}
void QtCreatorIntegration::slotNavigateToSlot(const QString &objectName, const QString &signalSignature,
const QStringList &parameterNames)
{

View File

@@ -8,8 +8,11 @@
QT_BEGIN_NAMESPACE
class QUrl;
class QVersionNumber;
QT_END_NAMESPACE
namespace Utils { class FilePath; }
namespace Designer {
namespace Internal {
@@ -27,10 +30,14 @@ public:
void updateSelection() override;
bool setQtVersionFromFile(const Utils::FilePath &filePath);
void resetQtVersion();
signals:
void creatorHelpRequested(const QUrl &url);
private:
void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow);
void slotNavigateToSlot(const QString &objectName, const QString &signalSignature, const QStringList &parameterNames);
void slotDesignerHelpRequested(const QString &manual, const QString &document);
void slotSyncSettingsToDesigner();
@@ -44,6 +51,10 @@ private:
void handleSymbolRenameStage2(QDesignerFormWindowInterface *formWindow,
const QString &newName, const QString &oldName);
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
void setQtVersion(const QVersionNumber &version);
#endif
class Private;
Private * const d;
};

View File

@@ -114,6 +114,7 @@ FakeVimSettings::FakeVimSettings()
tabStop.setToolTip(Tr::tr("Vim tabstop option."));
#ifndef FAKEVIM_STANDALONE
tabStop.setRange(1, 99);
backspace.setDisplayStyle(FvStringAspect::LineEditDisplay);
isKeyword.setDisplayStyle(FvStringAspect::LineEditDisplay);

View File

@@ -75,6 +75,7 @@ void setupFetchModule()
Module()
{
setSettingsGroup("Lua.Fetch");
setAutoApply(false);
pluginsAllowedToFetch.setSettingsKey("pluginsAllowedToFetch");
pluginsAllowedToFetch.setLabelText("Plugins allowed to fetch data from the internet");

View File

@@ -1140,6 +1140,7 @@ LinuxDevicePrivate::LinuxDevicePrivate(LinuxDevice *parent)
LinuxDevicePrivate::~LinuxDevicePrivate()
{
QMutexLocker locker(&m_shellMutex);
auto closeShell = [this] {
m_shellThread.quit();
m_shellThread.wait();

View File

@@ -38,7 +38,14 @@ enum MemcheckError
Leak_PossiblyLost,
Leak_StillReachable,
Leak_IndirectlyLost,
ReallocSizeZero
ReallocSizeZero,
InvalidSize,
InvalidSizeAndAlignment,
InvalidAlignment,
MismatchedAllocateDeallocateSize,
MismatchedAllocateDeallocateAlignment,
FishyValue,
// CoreMemError // questionable, seems to be unlikely to happen
};
Q_ENUM_NS(MemcheckError);

View File

@@ -35,10 +35,12 @@ VcpkgSettings::VcpkgSettings()
vcpkgRoot.setSettingsKey("VcpkgRoot");
vcpkgRoot.setExpectedKind(PathChooser::ExistingDirectory);
FilePath defaultPath = Environment::systemEnvironment().searchInPath(Constants::VCPKG_COMMAND)
.parentDir();
FilePath defaultPath = FilePath::fromUserInput(
qtcEnvironmentVariable(Constants::ENVVAR_VCPKG_ROOT));
if (!defaultPath.isDir())
defaultPath = FilePath::fromUserInput(qtcEnvironmentVariable(Constants::ENVVAR_VCPKG_ROOT));
defaultPath = Environment::systemEnvironment().searchInPath(Constants::VCPKG_COMMAND).parentDir();
if (defaultPath.isDir())
vcpkgRoot.setDefaultPathValue(defaultPath);