Merge "Merge remote-tracking branch 'origin/15.0'"

This commit is contained in:
The Qt Project
2024-12-06 09:49:33 +00:00
25 changed files with 176 additions and 60 deletions

View File

@@ -87,56 +87,54 @@ jobs:
string(REPLACE "." "" qt_version_dotless "${qt_version}") string(REPLACE "." "" qt_version_dotless "${qt_version}")
if ("${{ runner.os }}" STREQUAL "Windows") if ("${{ runner.os }}" STREQUAL "Windows")
set(url_os "windows_x86") set(url_os "windows_x86")
set(qt_package_arch_suffix "win64_msvc2019_64") set(qt_package_arch_suffix "win64_msvc2022_64")
set(qt_dir_prefix "${qt_version}/msvc2019_64") set(qt_dir_prefix "${qt_version}/msvc_64")
set(qt_package_suffix "-Windows-Windows_10_22H2-MSVC2019-Windows-Windows_10_22H2-X86_64") set(qt_package_suffix "-Windows-Windows_11_23H2-MSVC2022-Windows-Windows_11_23H2-X86_64")
elseif ("${{ runner.os }}" STREQUAL "Linux") elseif ("${{ runner.os }}" STREQUAL "Linux")
set(url_os "linux_x64") set(url_os "linux_x64")
if (qt_version VERSION_LESS "6.7.0") set(qt_package_arch_suffix "linux_gcc_64")
set(qt_package_arch_suffix "gcc_64")
else()
set(qt_package_arch_suffix "linux_gcc_64")
endif()
set(qt_dir_prefix "${qt_version}/gcc_64") set(qt_dir_prefix "${qt_version}/gcc_64")
set(qt_package_suffix "-Linux-RHEL_8_8-GCC-Linux-RHEL_8_8-X86_64") set(qt_package_suffix "-Linux-RHEL_8_10-GCC-Linux-RHEL_8_10-X86_64")
elseif ("${{ runner.os }}" STREQUAL "macOS") elseif ("${{ runner.os }}" STREQUAL "macOS")
set(url_os "mac_x64") set(url_os "mac_x64")
set(qt_package_arch_suffix "clang_64") set(qt_package_arch_suffix "clang_64")
set(qt_dir_prefix "${qt_version}/macos") set(qt_dir_prefix "${qt_version}/macos")
set(qt_package_suffix "-MacOS-MacOS_13-Clang-MacOS-MacOS_13-X86_64-ARM64") set(qt_package_suffix "-MacOS-MacOS_14-Clang-MacOS-MacOS_14-X86_64-ARM64")
endif() endif()
set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}") set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}/qt6_${qt_version_dotless}")
file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS) file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS)
file(READ ./Updates.xml updates_xml) file(READ ./Updates.xml updates_xml)
string(REGEX MATCH "<Name>qt.qt6.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}") string(REGEX MATCH "<Name>qt.qt6.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}")
set(qt_package_version ${CMAKE_MATCH_1}) set(qt_package_version ${CMAKE_MATCH_1})
file(MAKE_DIRECTORY qt6)
# Save the path for other steps # Save the path for other steps
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt6/${qt_dir_prefix}" qt_dir) file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt6/${qt_dir_prefix}" qt_dir)
file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_dir=${qt_dir}") file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_dir=${qt_dir}")
message("Downloading Qt to ${qt_dir}") message("Downloading Qt to ${qt_dir}")
function(downloadAndExtract url archive) function(downloadAndExtract url archive subdir)
file(MAKE_DIRECTORY "${qt_dir}/${subdir}")
message("Downloading ${url}") message("Downloading ${url}")
file(DOWNLOAD "${url}" ./${archive} SHOW_PROGRESS) message("... extracting to ${qt_dir}/${subdir}")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt6) file(DOWNLOAD "${url}" "$ENV{GITHUB_WORKSPACE}/${archive}" SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf "$ENV{GITHUB_WORKSPACE}/${archive}" WORKING_DIRECTORY "${qt_dir}/${subdir}")
endfunction() endfunction()
foreach(package qtbase qtdeclarative) foreach(package qtbase qtdeclarative)
downloadAndExtract( downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" "${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z ${package}.7z
""
) )
endforeach() endforeach()
foreach(package qt5compat qtshadertools) foreach(package qt5compat qtshadertools)
downloadAndExtract( downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" "${qt_base_url}/qt.qt6.${qt_version_dotless}.addons.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z ${package}.7z
""
) )
endforeach() endforeach()
@@ -150,9 +148,11 @@ jobs:
downloadAndExtract( downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-${uic_suffix}.7z" "${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-${uic_suffix}.7z"
icu.7z icu.7z
"lib"
) )
endif() endif()
execute_process(COMMAND ${qt_dir}/bin/qmake -query)
- name: Download Qt Creator - name: Download Qt Creator
uses: qt-creator/install-dev-package@v1.2 uses: qt-creator/install-dev-package@v1.2
with: with:

View File

@@ -920,7 +920,10 @@ expected_str<FilePath> Client::getCmdBridgePath(
const QString type = typeToString.value(osType); const QString type = typeToString.value(osType);
const QString arch = archToString.value(osArch); const QString arch = archToString.value(osArch);
const QString cmdBridgeName = QStringLiteral("cmdbridge-%1-%2").arg(type, arch); QString cmdBridgeName = QStringLiteral("cmdbridge-%1-%2").arg(type, arch);
if (osType == OsType::OsTypeWindows)
cmdBridgeName += QStringLiteral(".exe");
const FilePath result = libExecPath.resolvePath(cmdBridgeName); const FilePath result = libExecPath.resolvePath(cmdBridgeName);
if (result.exists()) if (result.exists())

View File

@@ -8,6 +8,10 @@ function(go_build NAME SOURCES PLATFORMS ARCHITECTURES LDFLAGS)
set(TARGET_NAME ${NAME}-${PLATFORM}-${ARCHITECTURE}) set(TARGET_NAME ${NAME}-${PLATFORM}-${ARCHITECTURE})
set(OUTPUT ${OUTPUT_FOLDER}/${TARGET_NAME}) set(OUTPUT ${OUTPUT_FOLDER}/${TARGET_NAME})
if (${PLATFORM} STREQUAL "windows")
string(APPEND OUTPUT ".exe")
endif()
if ((${PLATFORM} STREQUAL "linux" OR (${PLATFORM} STREQUAL "windows" AND ${ARCHITECTURE} STREQUAL "amd64")) AND NOT UPX_BIN STREQUAL "UPX_BIN-NOTFOUND") if ((${PLATFORM} STREQUAL "linux" OR (${PLATFORM} STREQUAL "windows" AND ${ARCHITECTURE} STREQUAL "amd64")) AND NOT UPX_BIN STREQUAL "UPX_BIN-NOTFOUND")
add_custom_command( add_custom_command(
OUTPUT "${OUTPUT}" OUTPUT "${OUTPUT}"

View File

@@ -20,6 +20,7 @@
#include <QPushButton> #include <QPushButton>
#include <QScrollArea> #include <QScrollArea>
#include <QSize> #include <QSize>
#include <QSizePolicy>
#include <QSpacerItem> #include <QSpacerItem>
#include <QSpinBox> #include <QSpinBox>
#include <QSplitter> #include <QSplitter>
@@ -808,6 +809,11 @@ void Widget::setCursor(Qt::CursorShape shape)
access(this)->setCursor(shape); access(this)->setCursor(shape);
} }
void Widget::setSizePolicy(const QSizePolicy &policy)
{
access(this)->setSizePolicy(policy);
}
void Widget::activateWindow() void Widget::activateWindow()
{ {
access(this)->activateWindow(); access(this)->activateWindow();

View File

@@ -31,6 +31,7 @@ class QObject;
class QPushButton; class QPushButton;
class QScrollArea; class QScrollArea;
class QSize; class QSize;
class QSizePolicy;
class QSpinBox; class QSpinBox;
class QSplitter; class QSplitter;
class QStackedWidget; class QStackedWidget;
@@ -253,6 +254,7 @@ public:
void setAutoFillBackground(bool); void setAutoFillBackground(bool);
void setLayout(const Layout &layout); void setLayout(const Layout &layout);
void setSize(int, int); void setSize(int, int);
void setSizePolicy(const QSizePolicy &policy);
void setFixedSize(const QSize &); void setFixedSize(const QSize &);
void setWindowTitle(const QString &); void setWindowTitle(const QString &);
void setWindowFlags(Qt::WindowFlags); void setWindowFlags(Qt::WindowFlags);
@@ -541,6 +543,7 @@ QTC_DEFINE_BUILDER_SETTER(widgetAttribute, setWidgetAttribute);
QTC_DEFINE_BUILDER_SETTER(autoFillBackground, setAutoFillBackground); QTC_DEFINE_BUILDER_SETTER(autoFillBackground, setAutoFillBackground);
QTC_DEFINE_BUILDER_SETTER(readOnly, setReadOnly); QTC_DEFINE_BUILDER_SETTER(readOnly, setReadOnly);
QTC_DEFINE_BUILDER_SETTER(markdown, setMarkdown); QTC_DEFINE_BUILDER_SETTER(markdown, setMarkdown);
QTC_DEFINE_BUILDER_SETTER(sizePolicy, setSizePolicy);
QTC_DEFINE_BUILDER_SETTER(basePath, setBasePath); QTC_DEFINE_BUILDER_SETTER(basePath, setBasePath);
QTC_DEFINE_BUILDER_SETTER(fixedSize, setFixedSize); QTC_DEFINE_BUILDER_SETTER(fixedSize, setFixedSize);

View File

@@ -445,6 +445,9 @@ void MarkdownBrowser::setMarkdown(const QString &markdown)
{ {
document()->setMarkdown(markdown); document()->setMarkdown(markdown);
postProcessDocument(true); postProcessDocument(true);
// Reset cursor to start of the document, so that "show" does not
// scroll to the end of the document.
setTextCursor(QTextCursor(document()));
} }
void MarkdownBrowser::postProcessDocument(bool firstTime) const void MarkdownBrowser::postProcessDocument(bool firstTime) const

View File

@@ -769,11 +769,17 @@ IssueListSearch IssuesWidget::searchFromUi() const
{ {
IssueListSearch search; IssueListSearch search;
QTC_ASSERT(m_currentTableInfo, return search); QTC_ASSERT(m_currentTableInfo, return search);
const int userIndex = m_ownerFilter->currentIndex();
QTC_ASSERT(userIndex >= 0 && m_userNames.size() > userIndex, return search);
const int versionStartIndex = m_versionStart->currentIndex();
QTC_ASSERT(versionStartIndex >= 0 && m_versionDates.size() > versionStartIndex, return search);
const int versionEndIndex = m_versionEnd->currentIndex();
QTC_ASSERT(versionEndIndex >= 0 && m_versionDates.size() > versionEndIndex, return search);
search.kind = m_currentPrefix; // not really ui.. but anyhow search.kind = m_currentPrefix; // not really ui.. but anyhow
search.owner = m_userNames.at(m_ownerFilter->currentIndex()); search.owner = m_userNames.at(userIndex);
search.filter_path = m_pathGlobFilter->text(); search.filter_path = m_pathGlobFilter->text();
search.versionStart = m_versionDates.at(m_versionStart->currentIndex()); search.versionStart = m_versionDates.at(versionStartIndex);
search.versionEnd = m_versionDates.at(m_versionEnd->currentIndex()); search.versionEnd = m_versionDates.at(versionEndIndex);
// different approach: checked means disabling in webview, checked here means explicitly request // different approach: checked means disabling in webview, checked here means explicitly request
// the checked one, having both checked is impossible (having none checked means fetch both) // the checked one, having both checked is impossible (having none checked means fetch both)
// reason for different approach: currently poor reflected inside the ui (TODO) // reason for different approach: currently poor reflected inside the ui (TODO)

View File

@@ -362,7 +362,9 @@ static QUrl constructUrl(const QString &projectName, const QString &subPath, con
{ {
if (!dd->m_dashboardInfo) if (!dd->m_dashboardInfo)
return {}; return {};
QUrl url = dd->m_dashboardInfo->source.resolved(QString("api/projects/" + projectName + '/')); const QByteArray encodedProjectName = QUrl::toPercentEncoding(projectName);
const QUrl path(QString{"api/projects/" + QString::fromUtf8(encodedProjectName) + '/'});
QUrl url = dd->m_dashboardInfo->source.resolved(path);
if (!subPath.isEmpty() && QTC_GUARD(!subPath.startsWith('/'))) if (!subPath.isEmpty() && QTC_GUARD(!subPath.startsWith('/')))
url = url.resolved(subPath); url = url.resolved(subPath);
if (!query.isEmpty()) if (!query.isEmpty())

View File

@@ -225,6 +225,7 @@ AxivionSettings &settings()
AxivionSettings::AxivionSettings() AxivionSettings::AxivionSettings()
{ {
setSettingsGroup("Axivion"); setSettingsGroup("Axivion");
setAutoApply(false);
highlightMarks.setSettingsKey("HighlightMarks"); highlightMarks.setSettingsKey("HighlightMarks");
highlightMarks.setLabelText(Tr::tr("Highlight marks")); highlightMarks.setLabelText(Tr::tr("Highlight marks"));
@@ -490,6 +491,7 @@ void AxivionSettingsWidget::apply()
: servers.at(m_dashboardServers->currentIndex()).id; : servers.at(m_dashboardServers->currentIndex()).id;
if (settings().updateDashboardServers(servers, selected)) if (settings().updateDashboardServers(servers, selected))
settings().toSettings(); settings().toSettings();
settings().apply();
} }
void AxivionSettingsWidget::updateDashboardServers() void AxivionSettingsWidget::updateDashboardServers()

View File

@@ -930,8 +930,14 @@ clang::format::FormatStyle ClangFormatBaseIndenterPrivate::customSettingsStyle(
return currentQtStyle(preferences); return currentQtStyle(preferences);
clang::format::FormatStyle currentSettingsStyle; clang::format::FormatStyle currentSettingsStyle;
const Utils::expected_str<void> success = parseConfigurationFile(filePath, currentSettingsStyle); const Utils::expected_str<void> result = parseConfigurationFile(filePath, currentSettingsStyle);
QTC_ASSERT(success, return currentQtStyle(preferences)); if (!result) {
qCWarning(clangIndenterLog)
<< QString{"Failed to parse config %1. Falling back to the Qt style."}.arg(
filePath.toUserOutput())
<< result.error();
return currentQtStyle(preferences);
};
return currentSettingsStyle; return currentSettingsStyle;
} }

View File

@@ -201,7 +201,7 @@ void ClangFormatConfigWidget::initEditor()
this); this);
connect(m_editor->document(), &TextEditor::TextDocument::contentsChanged, this, [this] { connect(m_editor->document(), &TextEditor::TextDocument::contentsChanged, this, [this] {
clang::format::FormatStyle currentSettingsStyle; clang::format::FormatStyle currentSettingsStyle{};
const Utils::expected_str<void> success const Utils::expected_str<void> success
= parseConfigurationContent(m_editor->document()->contents().toStdString(), = parseConfigurationContent(m_editor->document()->contents().toStdString(),
currentSettingsStyle); currentSettingsStyle);

View File

@@ -378,8 +378,8 @@ void EditorToolBar::setGoForwardMenu(QMenu *menu)
void EditorToolBar::updateActionShortcuts() void EditorToolBar::updateActionShortcuts()
{ {
d->m_closeEditorButton->setToolTip(ActionManager::command(Constants::CLOSE)->stringWithAppendedShortcut(Tr::tr("Close Document"))); d->m_closeEditorButton->setToolTip(ActionManager::command(Constants::CLOSE)->stringWithAppendedShortcut(Tr::tr("Close Document")));
d->m_goBackAction->setToolTip(ActionManager::command(Constants::GO_BACK)->action()->toolTip()); d->m_goBackAction->setToolTip(ActionManager::command(Constants::GO_BACK)->stringWithAppendedShortcut(Tr::tr("Go Back")));
d->m_goForwardAction->setToolTip(ActionManager::command(Constants::GO_FORWARD)->action()->toolTip()); d->m_goForwardAction->setToolTip(ActionManager::command(Constants::GO_FORWARD)->stringWithAppendedShortcut(Tr::tr("Go Forward")));
d->m_closeSplitButton->setToolTip(ActionManager::command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(Tr::tr("Remove Split"))); d->m_closeSplitButton->setToolTip(ActionManager::command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(Tr::tr("Remove Split")));
} }

View File

@@ -347,11 +347,16 @@ public:
{} {}
// IAssistProposal interface // IAssistProposal interface
bool hasItemsToPropose(const QString &/*text*/, AssistReason reason) const override bool hasItemsToPropose(const QString &prefix, AssistReason reason) const override
{ {
if (m_model->size() <= 0 || m_document.isNull()) if (m_model->size() <= 0 || m_document.isNull())
return false; return false;
if (!prefix.isEmpty()) {
m_model->filter(prefix);
m_model->setPrefilterPrefix(prefix);
}
return m_model->keepPerfectMatch(reason) return m_model->keepPerfectMatch(reason)
|| !Utils::anyOf(m_model->items(), [this](AssistProposalItemInterface *item){ || !Utils::anyOf(m_model->items(), [this](AssistProposalItemInterface *item){
if (const auto lcItem = dynamic_cast<LanguageClientCompletionItem *>(item)) if (const auto lcItem = dynamic_cast<LanguageClientCompletionItem *>(item))

View File

@@ -285,6 +285,11 @@ QList<Client *> LanguageClientManager::clientsSupportingDocument(
[doc](Client *client) { return client->isSupportedDocument(doc); }); [doc](Client *client) { return client->isSupportedDocument(doc); });
} }
void LanguageClientManager::writeSettings()
{
LanguageClientSettings::toSettings(Core::ICore::settings(), managerInstance->m_currentSettings);
}
void LanguageClientManager::applySettings() void LanguageClientManager::applySettings()
{ {
QTC_ASSERT(managerInstance, return); QTC_ASSERT(managerInstance, return);
@@ -292,7 +297,7 @@ void LanguageClientManager::applySettings()
managerInstance->m_currentSettings managerInstance->m_currentSettings
= Utils::transform(LanguageClientSettings::pageSettings(), &BaseSettings::copy); = Utils::transform(LanguageClientSettings::pageSettings(), &BaseSettings::copy);
const QList<BaseSettings *> restarts = LanguageClientSettings::changedSettings(); const QList<BaseSettings *> restarts = LanguageClientSettings::changedSettings();
LanguageClientSettings::toSettings(Core::ICore::settings(), managerInstance->m_currentSettings); writeSettings();
for (BaseSettings *settings : restarts) for (BaseSettings *settings : restarts)
applySettings(settings); applySettings(settings);
@@ -318,41 +323,31 @@ void LanguageClientManager::applySettings(BaseSettings *setting)
managerInstance->m_clientForDocument.remove(document); managerInstance->m_clientForDocument.remove(document);
if (!setting->isValid()) if (!setting->isValid())
return; return;
switch (setting->m_startBehavior) { if (setting->m_startBehavior == BaseSettings::AlwaysOn || BaseSettings::RequiresFile) {
case BaseSettings::AlwaysOn: {
if (!setting->m_enabled) if (!setting->m_enabled)
return; return;
Client *client = startClient(setting); auto ensureClient = [setting, client = static_cast<Client *>(nullptr)]() mutable {
for (TextEditor::TextDocument *document : std::as_const(documents)) if (!client)
managerInstance->m_clientForDocument[document] = client; client = startClient(setting);
break; return client;
} };
case BaseSettings::RequiresFile: { if (setting->m_startBehavior == BaseSettings::AlwaysOn)
if (!setting->m_enabled) ensureClient();
return;
Client *client = nullptr;
for (TextEditor::TextDocument *previousDocument : std::as_const(documents)) { for (TextEditor::TextDocument *previousDocument : std::as_const(documents)) {
if (setting->m_languageFilter.isSupported(previousDocument)) { if (setting->m_languageFilter.isSupported(previousDocument))
if (!client) openDocumentWithClient(previousDocument, ensureClient());
client = startClient(setting);
openDocumentWithClient(previousDocument, client);
}
} }
const QList<Core::IDocument *> &openedDocuments = Core::DocumentModel::openedDocuments(); const QList<Core::IDocument *> &openedDocuments = Core::DocumentModel::openedDocuments();
for (Core::IDocument *document : openedDocuments) { for (Core::IDocument *document : openedDocuments) {
if (documents.contains(document)) if (documents.contains(document))
continue; // already handled above continue; // already handled above
if (auto textDocument = qobject_cast<TextEditor::TextDocument *>(document)) { if (auto textDocument = qobject_cast<TextEditor::TextDocument *>(document)) {
if (setting->m_languageFilter.isSupported(document)) { if (setting->m_languageFilter.isSupported(document))
if (!client) ensureClient()->openDocument(textDocument);
client = startClient(setting);
client->openDocument(textDocument);
}
} }
} }
break; } else if (setting->m_startBehavior == BaseSettings::RequiresProject) {
}
case BaseSettings::RequiresProject: {
const QList<Core::IDocument *> &openedDocuments = Core::DocumentModel::openedDocuments(); const QList<Core::IDocument *> &openedDocuments = Core::DocumentModel::openedDocuments();
QHash<ProjectExplorer::Project *, Client *> clientForProject; QHash<ProjectExplorer::Project *, Client *> clientForProject;
for (Core::IDocument *document : openedDocuments) { for (Core::IDocument *document : openedDocuments) {
@@ -380,10 +375,6 @@ void LanguageClientManager::applySettings(BaseSettings *setting)
} }
} }
} }
break;
}
default:
break;
} }
} }

View File

@@ -54,6 +54,7 @@ public:
static void applySettings(); static void applySettings();
static void applySettings(const QString &settingsId); static void applySettings(const QString &settingsId);
static void applySettings(BaseSettings *settings); static void applySettings(BaseSettings *settings);
static void writeSettings();
static QList<BaseSettings *> currentSettings(); static QList<BaseSettings *> currentSettings();
static void registerClientSettings(BaseSettings *settings); static void registerClientSettings(BaseSettings *settings);
static void enableClientSettings(const QString &settingsId, bool enable = true); static void enableClientSettings(const QString &settingsId, bool enable = true);

View File

@@ -308,7 +308,17 @@ public:
if (m_aspects) { if (m_aspects) {
connect(m_aspects, &AspectContainer::applied, this, [this] { connect(m_aspects, &AspectContainer::applied, this, [this] {
updateOptions(); updateOptions();
LanguageClientManager::applySettings(); auto settings = Utils::findOr(
LanguageClientManager::currentSettings(), nullptr, [this](BaseSettings *s) {
return s->m_id == m_clientSettingsId;
});
if (settings) {
LanguageClientManager::applySettings(settings);
LanguageClientManager::writeSettings();
} else {
LanguageClientManager::applySettings();
}
}); });
} }

View File

@@ -88,6 +88,7 @@ CREATE_HAS_FUNC(onTextChanged, nullptr, nullptr)
CREATE_HAS_FUNC(onClicked, nullptr, nullptr) CREATE_HAS_FUNC(onClicked, nullptr, nullptr)
CREATE_HAS_FUNC(setText, QString()) CREATE_HAS_FUNC(setText, QString())
CREATE_HAS_FUNC(setMarkdown, QString()) CREATE_HAS_FUNC(setMarkdown, QString())
CREATE_HAS_FUNC(setSizePolicy, QSizePolicy())
CREATE_HAS_FUNC(setReadOnly, bool()) CREATE_HAS_FUNC(setReadOnly, bool())
CREATE_HAS_FUNC(setTitle, QString()) CREATE_HAS_FUNC(setTitle, QString())
CREATE_HAS_FUNC(setValue, int()) CREATE_HAS_FUNC(setValue, int())
@@ -290,6 +291,19 @@ void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject
if (markdown) if (markdown)
item->setMarkdown(*markdown); item->setMarkdown(*markdown);
} }
if constexpr (has_setSizePolicy<T>) {
auto sizePolicy = children.get<sol::optional<sol::table>>("sizePolicy");
if (sizePolicy) {
QTC_ASSERT(
sizePolicy->size() == 2,
throw sol::error(
"sizePolicy must be array of 2 elements: horizontalPolicy, verticalPolicy.")
);
auto horizontalPolicy = sizePolicy->get<QSizePolicy::Policy>(1);
auto verticalPolicy = sizePolicy->get<QSizePolicy::Policy>(2);
item->setSizePolicy(QSizePolicy(horizontalPolicy, verticalPolicy));
}
}
if constexpr (has_setTitle<T>) { if constexpr (has_setTitle<T>) {
item->setTitle(children.get_or<QString>("title", "")); item->setTitle(children.get_or<QString>("title", ""));
} }
@@ -552,6 +566,9 @@ void setupGuiModule()
mirrorEnum(gui, QMetaEnum::fromType<Qt::TextInteractionFlag>()); mirrorEnum(gui, QMetaEnum::fromType<Qt::TextInteractionFlag>());
mirrorEnum(gui, QMetaEnum::fromType<Qt::CursorShape>()); mirrorEnum(gui, QMetaEnum::fromType<Qt::CursorShape>());
auto sizePolicy = gui.create_named("QSizePolicy");
mirrorEnum(sizePolicy, QMetaEnum::fromType<QSizePolicy::Policy>());
gui.new_usertype<Stack>( gui.new_usertype<Stack>(
"Stack", "Stack",
sol::call_constructor, sol::call_constructor,

View File

@@ -9,6 +9,7 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QCursor>
#include <QCompleter> #include <QCompleter>
#include <QDir> #include <QDir>
#include <QFileDevice> #include <QFileDevice>
@@ -54,6 +55,12 @@ void setupQtModule()
qt["clipboard"] = &QApplication::clipboard; qt["clipboard"] = &QApplication::clipboard;
qt.new_usertype<QCursor>(
"QCursor",
sol::no_constructor,
"pos", sol::resolve<QPoint()>(&QCursor::pos)
);
qt.new_usertype<QFontMetrics>( qt.new_usertype<QFontMetrics>(
"QFontMetrics", "QFontMetrics",
"create", "create",

View File

@@ -381,6 +381,13 @@ void setupTextEditorModule()
"insertText", "insertText",
[](TextEditorPtr editor, const QString &text) { [](TextEditorPtr editor, const QString &text) {
editor->editorWidget()->multiTextCursor().insertText(text); editor->editorWidget()->multiTextCursor().insertText(text);
},
"hasFocus",
[](const TextEditorPtr &textEditor) {
QTC_ASSERT(
textEditor && textEditor->editorWidget(),
throw sol::error("TextEditor is not valid"));
return textEditor->editorWidget()->hasFocus();
}); });
result.new_usertype<TextSuggestion::Data>( result.new_usertype<TextSuggestion::Data>(

View File

@@ -26,6 +26,7 @@ gui.widget = {}
---@field windowFlags? WindowType[] The window flags of the widget. ---@field windowFlags? WindowType[] The window flags of the widget.
---@field widgetAttributes? WidgetAttributeMapT<boolean> The widget attributes of the widget. ---@field widgetAttributes? WidgetAttributeMapT<boolean> The widget attributes of the widget.
---@field autoFillBackground? boolean A boolean, representing whether the widget should automatically fill its background. ---@field autoFillBackground? boolean A boolean, representing whether the widget should automatically fill its background.
---@field sizePolicy? SizePolicy.Policy[] Two size policies of the widget, horizontal and vertical.
gui.baseWidgetOptions = {} gui.baseWidgetOptions = {}
---@class (exact) WidgetOptions : BaseWidgetOptions ---@class (exact) WidgetOptions : BaseWidgetOptions
@@ -463,6 +464,20 @@ gui.CursorShape = {
CustomCursor = 0 CustomCursor = 0
} }
gui.SizePolicy = {
--- Enum representing size policy.
---@enum Policy
Policy = {
Fixed = 0,
Minimum = 0,
Maximum = 0,
Preferred = 0,
MinimumExpanding = 0,
Expanding = 0,
Ignored = 0
}
}
---@class Space : Layout ---@class Space : Layout
gui.space = {} gui.space = {}

View File

@@ -34,6 +34,13 @@ qt.QClipboard = {}
---@return QClipboard globalClipboard The global clipboard object. ---@return QClipboard globalClipboard The global clipboard object.
function qt.clipboard() end function qt.clipboard() end
--@class QCursor A Lua wrapper for the Qt `QCursor` class.
qt.QCursor = {}
---Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
---@return QPoint position The position of the cursor.
function qt.QCursor.pos() end
---@class QFontMetrics A Lua wrapper for the Qt `QFontMetrics` class. ---@class QFontMetrics A Lua wrapper for the Qt `QFontMetrics` class.
qt.QFontMetrics = {} qt.QFontMetrics = {}

View File

@@ -150,6 +150,10 @@ function TextEditor:hasLockedSuggestion() end
---@param text string The text to insert. ---@param text string The text to insert.
function TextEditor:insertText(text) end function TextEditor:insertText(text) end
---Indicates if the editor widget has focus.
---@return boolean hasFocus True if the editor widget has focus, false otherwise.
function TextEditor:hasFocus() end
---Returns the current editor or nil. ---Returns the current editor or nil.
---@return TextEditor|nil editor The currently active editor or nil if there is none. ---@return TextEditor|nil editor The currently active editor or nil if there is none.
function textEditor.currentEditor() end function textEditor.currentEditor() end

View File

@@ -116,6 +116,7 @@ static QVariant fromSettingsTransformation(const QVariant &v)
QmlJsEditingSettings::QmlJsEditingSettings() QmlJsEditingSettings::QmlJsEditingSettings()
{ {
setAutoApply(false);
const Key group = QmlJSEditor::Constants::SETTINGS_CATEGORY_QML; const Key group = QmlJSEditor::Constants::SETTINGS_CATEGORY_QML;
enableContextPane.setSettingsKey(group, QML_CONTEXTPANE_KEY); enableContextPane.setSettingsKey(group, QML_CONTEXTPANE_KEY);

View File

@@ -110,6 +110,14 @@ macro(qtc_auto_setup_conan)
file(COPY "${conanfile_txt}" DESTINATION "${CMAKE_BINARY_DIR}/conan-dependencies/") file(COPY "${conanfile_txt}" DESTINATION "${CMAKE_BINARY_DIR}/conan-dependencies/")
# conanfile should have a generator specified, when both file and conan_install
# specifcy the CMakeDeps generator, conan_install will issue an error
file(READ "${conanfile_txt}" conanfile_text_content)
unset(conan_generator)
if (NOT "${conanfile_text_content}" MATCHES ".*CMakeDeps.*")
set(conan_generator "-g CMakeDeps")
endif()
file(WRITE "${CMAKE_BINARY_DIR}/conan-dependencies/toolchain.cmake" " file(WRITE "${CMAKE_BINARY_DIR}/conan-dependencies/toolchain.cmake" "
set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\") set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")
set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\") set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\")
@@ -143,7 +151,7 @@ macro(qtc_auto_setup_conan)
-pr \"${CMAKE_BINARY_DIR}/conan-dependencies/conan_host_profile\" -pr \"${CMAKE_BINARY_DIR}/conan-dependencies/conan_host_profile\"
--build=${QT_CREATOR_CONAN_BUILD_POLICY} --build=${QT_CREATOR_CONAN_BUILD_POLICY}
-s build_type=\${type} -s build_type=\${type}
-g CMakeDeps) ${conan_generator})
endforeach() endforeach()
get_property(CONAN_INSTALL_SUCCESS GLOBAL PROPERTY CONAN_INSTALL_SUCCESS) get_property(CONAN_INSTALL_SUCCESS GLOBAL PROPERTY CONAN_INSTALL_SUCCESS)

View File

@@ -52,6 +52,14 @@ def main():
earlyExit("Did not find first line in function block.") earlyExit("Did not find first line in function block.")
return return
type(editorWidget, "<Return>") type(editorWidget, "<Return>")
if useClang:
codeModelInMain = lambda: object.exists(
"{currentText='main(int, char **) -> int '"
" type='QComboBox' unnamed='1' visible='1'"
" window=':Qt Creator_Core::Internal::MainWindow'}")
if not waitFor(codeModelInMain, 5000):
test.warning("ComboBox does not display expected main function",
"Did this slow down or did the displayed content change?")
type(editorWidget, "re") type(editorWidget, "re")
triggerCompletion(editorWidget) triggerCompletion(editorWidget)
functionName = "realpath" functionName = "realpath"
@@ -63,7 +71,7 @@ def main():
test.compare(str(lineUnderCursor(editorWidget)).strip(), functionName + "()", test.compare(str(lineUnderCursor(editorWidget)).strip(), functionName + "()",
"Step 3: Verifying if: The list of suggestions is opened. It is " "Step 3: Verifying if: The list of suggestions is opened. It is "
"possible to select one of the suggestions.") "possible to select one of the suggestions.")
# Step 4: Insert text "voi" to new line and press Tab. # Step 4: Insert text "unsig" to new line and press Tab.
resetLine(editorWidget) resetLine(editorWidget)
type(editorWidget, "unsig") type(editorWidget, "unsig")
try: try: