Merge remote-tracking branch 'origin/10.0'

Change-Id: I98e5e1ad43103984b490c65cdeed84b7414303b3
This commit is contained in:
Eike Ziller
2023-05-11 10:33:18 +02:00
19 changed files with 185 additions and 75 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -38,22 +38,26 @@
The process of setting up debugging for Qt Quick projects depends on the
\l{Creating Qt Quick Projects}{type of the project}: Qt Quick UI or Qt Quick
Application, and the Qt version used.
\section2 Debugging Qt Quick UI Projects
\endif
To debug Qt Quick UI projects, select the \uicontrol {Enable QML} check box in the
\uicontrol {Debugger Settings} in \uicontrol Projects mode \uicontrol {Run Settings}.
To debug Qt Quick UI projects (.qmlproject), select the
\uicontrol {Enable QML} check box in \uicontrol {Debugger settings}
in \uicontrol Projects mode \uicontrol {Run Settings}.
\if defined(qtcreator)
\section2 Debugging Qt Quick Applications
To debug Qt Quick Applications:
\list 1
\li If you use qmake as the build system, make sure that
debugging is enabled in the \uicontrol {Build Settings},
\uicontrol {QML debugging and profiling} field, either
explicitly for the project or globally by default.
\li To create a build configuration that supports QML debugging,
select \uicontrol {Projects} > \uicontrol {Build} >
\uicontrol {QML debugging and profiling} > \uicontrol Enable.
\image qtcreator-projectpane.png "qmake general build settings pane"
\image qtcreator-build-settings-cmake-configure.webp {Build settings for a CMake project}
\note Debugging requires opening a socket at a TCP port,
which presents a security risk. Anyone on the Internet could connect
@@ -61,9 +65,9 @@
functions. Therefore, you must make sure that the port is properly
protected by a firewall.
\li In the \uicontrol {Run Settings}, \uicontrol {Debugger Settings} section, select
the \uicontrol {Enable QML} check box to enable
QML debugging.
\li In \uicontrol {Run Settings} > \uicontrol {Debugger settings}, select
the \uicontrol {Enable QML} check box to enable QML debugging for
running applications.
\li Select \uicontrol Build > \uicontrol {Rebuild Project} to clean and
rebuild the project.
@@ -79,6 +83,43 @@
automatically installed during \QC and Qt installation. Do not delete
them if you plan to debug QML applications.
\section2 Using Default Values
You can enable or disable QML debugging globally in \uicontrol Edit >
\uicontrol Preferences > \uicontrol {Build & Run} >
\uicontrol {Default Build Properties}.
\image qtcreator-build-settings-default.png "Default Build Properties tab in Build & Run Preferences"
The value of the \uicontrol {QML debugging} field determines what happens
when creating new build configurations. The values \uicontrol Enable
and \uicontrol Disable explicitly set QML debugging for the new build
configuration to that value, regardless of what type of build
configuration you create.
\uicontrol {Use Project Default} makes the values depend on the type of
build configuration: \uicontrol Debug, \uicontrol Profile, or
\uicontrol Release. When you use \l {CMake Build Configuration}{CMake} or
\l {qmake Build Configuration}{qmake} as a build system, debug and profile
build configurations have QML debugging enabled. However, release build
configurations do not include QML debugging because the debugging feature
makes applications vulnerable.
The \uicontrol {Leave at Default} option in \uicontrol {Projects} >
\uicontrol {Build} > \uicontrol {QML debugging and profiling} is needed to keep existing,
already configured CMake build directories intact. Also, it
enables you to import an existing build into \QC without enforced changes,
so that you don't have to worry about a complete rebuild of the project, for
example. Even if you later change the configuration of the build outside of
\QC, it will be kept as you want it.
There are some known issues in the interaction between the global setting
in \uicontrol Edit > \uicontrol Preferences > \uicontrol {Build & Run} >
\uicontrol {Default Build Properties} and the build configuration.
For example, for qmake the global setting only affects build configurations
that are automatically created when enabling a kit. Also, CMake ignores the
global setting.
\section1 Mixed C++/QML Debugging
To debug both the C++ and QML parts of your application at the same time,
@@ -87,7 +128,7 @@
\uicontrol{Run Settings}.
\endif
\image qtquick-debugging-settings.png
\image qtquick-debugging-settings.png {Debugger settings section in Run Settings}
\section1 Starting QML Debugging

View File

@@ -276,16 +276,20 @@ void FileSystemWatcher::addFiles(const QStringList &files, WatchMode wm)
const int count = ++d->m_staticData->m_fileCount[file];
Q_ASSERT(count > 0);
if (count == 1)
if (count == 1) {
toAdd << file;
const QString directory = QFileInfo(file).path();
QFileInfo fi(file);
if (!fi.exists()) {
const QString directory = fi.path();
const int dirCount = ++d->m_staticData->m_directoryCount[directory];
Q_ASSERT(dirCount > 0);
if (dirCount == 1)
toAdd << directory;
}
}
}
if (!toAdd.isEmpty())
d->m_staticData->m_watcher->addPaths(toAdd);
@@ -312,16 +316,20 @@ void FileSystemWatcher::removeFiles(const QStringList &files)
const int count = --(d->m_staticData->m_fileCount[file]);
Q_ASSERT(count >= 0);
if (!count)
if (!count) {
toRemove << file;
const QString directory = QFileInfo(file).path();
QFileInfo fi(file);
if (!fi.exists()) {
const QString directory = fi.path();
const int dirCount = --d->m_staticData->m_directoryCount[directory];
Q_ASSERT(dirCount >= 0);
if (!dirCount)
toRemove << directory;
}
}
}
if (!toRemove.isEmpty())
d->m_staticData->m_watcher->removePaths(toRemove);
@@ -419,13 +427,27 @@ QStringList FileSystemWatcher::directories() const
void FileSystemWatcher::slotFileChanged(const QString &path)
{
const auto it = d->m_files.find(path);
QStringList toAdd;
if (it != d->m_files.end() && it.value().trigger(path)) {
qCDebug(fileSystemWatcherLog)
<< this << "triggers on file" << it.key()
<< it.value().watchMode
<< it.value().modifiedTime.toString(Qt::ISODate);
d->fileChanged(path);
QFileInfo fi(path);
if (!fi.exists()) {
const QString directory = fi.path();
const int dirCount = ++d->m_staticData->m_directoryCount[directory];
Q_ASSERT(dirCount > 0);
if (dirCount == 1)
toAdd << directory;
}
}
if (!toAdd.isEmpty())
d->m_staticData->m_watcher->addPaths(toAdd);
}
void FileSystemWatcher::slotDirectoryChanged(const QString &path)
@@ -451,9 +473,20 @@ void FileSystemWatcher::slotDirectoryChanged(const QString &path)
for (const QString &rejected : d->m_staticData->m_watcher->addPaths(toReadd))
toReadd.removeOne(rejected);
QStringList toRemove;
// If we've successfully added the file, that means it was deleted and replaced.
for (const QString &reAdded : std::as_const(toReadd))
for (const QString &reAdded : std::as_const(toReadd)) {
d->fileChanged(reAdded);
const QString directory = QFileInfo(reAdded).path();
const int dirCount = --d->m_staticData->m_directoryCount[directory];
Q_ASSERT(dirCount >= 0);
if (!dirCount)
toRemove << directory;
}
if (!toRemove.isEmpty())
d->m_staticData->m_watcher->removePaths(toRemove);
}
}

View File

@@ -88,8 +88,8 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(TextEditor::ICodeStylePreferenc
d->checksScrollArea->setWidget(d->checksWidget);
d->checksScrollArea->setWidgetResizable(true);
d->checksWidget->setEnabled(!codeStyle->isReadOnly()
&& !codeStyle->isTemporarilyReadOnly());
d->checksWidget->setEnabled(!codeStyle->isReadOnly() && !codeStyle->isTemporarilyReadOnly()
&& !codeStyle->isAdditionalTabDisabled());
FilePath fileName;
if (d->project)
@@ -140,8 +140,8 @@ void ClangFormatConfigWidget::slotCodeStyleChanged(
d->config->setIsReadOnly(codeStyle->isReadOnly());
d->style = d->config->style();
d->checksWidget->setEnabled(!codeStyle->isReadOnly()
&& !codeStyle->isTemporarilyReadOnly());
d->checksWidget->setEnabled(!codeStyle->isReadOnly() && !codeStyle->isTemporarilyReadOnly()
&& !codeStyle->isAdditionalTabDisabled());
fillTable();
updatePreview();

View File

@@ -156,9 +156,20 @@ void ClangFormatGlobalConfigWidget::initOverrideCheckBox()
"can be overridden by the settings below."));
}
auto setEnableOverrideCheckBox = [this](int index) {
auto setTemporarilyReadOnly = [this]() {
if (m_ignoreChanges.isLocked())
return;
Utils::GuardLocker locker(m_ignoreChanges);
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_overrideDefault->isChecked());
m_codeStyle->currentPreferences()->setIsAdditionalTabDisabled(!m_overrideDefault->isEnabled());
ClangFormatSettings::instance().write();
emit m_codeStyle->currentPreferencesChanged(m_codeStyle->currentPreferences());
};
auto setEnableOverrideCheckBox = [this, setTemporarilyReadOnly](int index) {
bool isDisable = index == static_cast<int>(ClangFormatSettings::Mode::Disable);
m_overrideDefault->setDisabled(isDisable);
setTemporarilyReadOnly();
};
setEnableOverrideCheckBox(m_indentingOrFormatting->currentIndex());
@@ -176,20 +187,19 @@ void ClangFormatGlobalConfigWidget::initOverrideCheckBox()
".clang-format file."));
m_overrideDefault->setChecked(getProjectOverriddenSettings(m_project));
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_overrideDefault->isChecked());
setTemporarilyReadOnly();
connect(m_overrideDefault, &QCheckBox::toggled, this, [this](bool checked) {
connect(m_overrideDefault, &QCheckBox::toggled, this, [this, setTemporarilyReadOnly](bool checked) {
if (m_project)
m_project->setNamedSettings(Constants::OVERRIDE_FILE_ID, checked);
else {
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!checked);
emit m_codeStyle->currentPreferencesChanged(m_codeStyle->currentPreferences());
}
else
setTemporarilyReadOnly();
});
connect(m_codeStyle, &TextEditor::ICodeStylePreferences::currentPreferencesChanged, this, [this] {
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_overrideDefault->isChecked());
});
connect(m_codeStyle,
&TextEditor::ICodeStylePreferences::currentPreferencesChanged,
this,
setTemporarilyReadOnly);
}

View File

@@ -5,6 +5,8 @@
#include <cppeditor/cppcodestylesettingspage.h>
#include <utils/guard.h>
#include <memory>
QT_BEGIN_NAMESPACE
@@ -40,6 +42,7 @@ private:
ProjectExplorer::Project *m_project;
TextEditor::ICodeStylePreferences *m_codeStyle;
Utils::Guard m_ignoreChanges;
QLabel *m_projectHasClangFormat;
QLabel *m_formattingModeLabel;

View File

@@ -213,9 +213,13 @@ bool getCurrentOverriddenSettings(const Utils::FilePath &filePath)
const ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::projectForFile(
filePath);
return getProjectUseGlobalSettings(project) ? !TextEditor::TextEditorSettings::codeStyle("Cpp")
return getProjectUseGlobalSettings(project)
? !TextEditor::TextEditorSettings::codeStyle("Cpp")
->currentPreferences()
->isTemporarilyReadOnly()
&& !TextEditor::TextEditorSettings::codeStyle("Cpp")
->currentPreferences()
->isAdditionalTabDisabled()
: getProjectOverriddenSettings(project);
}

View File

@@ -61,6 +61,8 @@ public:
Utils::Id id() const { return m_id; }
QVariantMap toMap () const;
void setAutorun(bool autoRun) { m_isAutoRun = autoRun; }
void setFilePath(const Utils::FilePath &executable);
Utils::FilePath filePath() const;
Utils::FilePath cmakeExecutable() const;

View File

@@ -141,6 +141,7 @@ void CMakeToolManager::restoreCMakeTools()
emit m_instance->cmakeToolsLoaded();
// Store the default CMake tool "Autorun CMake" value globally
// TODO: Remove in Qt Creator 13
auto settings = Internal::CMakeSpecificSettings::instance();
if (settings->autorunCMake.value() == settings->autorunCMake.defaultValue()) {
CMakeTool *cmake = defaultCMakeTool();

View File

@@ -4,6 +4,7 @@
#include "cmaketoolsettingsaccessor.h"
#include "cmakeprojectmanagertr.h"
#include "cmakespecificsettings.h"
#include "cmaketool.h"
#include <coreplugin/icore.h>
@@ -184,9 +185,14 @@ void CMakeToolSettingsAccessor::saveCMakeTools(const QList<CMakeTool *> &cmakeTo
data.insert(QLatin1String(CMAKE_TOOL_DEFAULT_KEY), defaultId.toSetting());
int count = 0;
for (const CMakeTool *item : cmakeTools) {
for (CMakeTool *item : cmakeTools) {
Utils::FilePath fi = item->cmakeExecutable();
// Gobal Autorun value will be set for all tools
// TODO: Remove in Qt Creator 13
const auto settings = CMakeSpecificSettings::instance();
item->setAutorun(settings->autorunCMake.value());
if (fi.needsDevice() || fi.isExecutableFile()) { // be graceful for device related stuff
QVariantMap tmp = item->toMap();
if (tmp.isEmpty())

View File

@@ -426,7 +426,8 @@ void CppCodeStylePreferencesWidget::setCodeStyleSettings(const CppCodeStyleSetti
void CppCodeStylePreferencesWidget::slotCurrentPreferencesChanged(ICodeStylePreferences *preferences, bool preview)
{
const bool enable = !preferences->isReadOnly() && !preferences->isTemporarilyReadOnly();
const bool enable = !preferences->isReadOnly() && (!preferences->isTemporarilyReadOnly()
|| preferences->isAdditionalTabDisabled());
for (QWidget *widget : d->m_controllers)
widget->setEnabled(enable);

View File

@@ -3827,6 +3827,7 @@ public:
GenerateProperty = 1 << 5,
GenerateConstantProperty = 1 << 6,
HaveExistingQProperty = 1 << 7,
Invalid = -1,
};
GenerateGetterSetterOp(const CppQuickFixInterface &interface,
@@ -4524,7 +4525,7 @@ public:
};
using Flag = GenerateGetterSetterOp::GenerateFlag;
constexpr static Flag ColumnFlag[] = {
static_cast<Flag>(-1),
Flag::Invalid,
Flag::GenerateGetter,
Flag::GenerateSetter,
Flag::GenerateSignal,

View File

@@ -266,9 +266,20 @@ public:
void expandNode(const QModelIndex &idx)
{
if (!m_engine)
return;
m_expandedINames.insert(idx.data(LocalsINameRole).toString());
if (canFetchMore(idx))
fetchMore(idx);
if (canFetchMore(idx)) {
if (!idx.isValid())
return;
if (auto item = dynamic_cast<ToolTipWatchItem *>(itemForIndex(idx))) {
WatchItem *it = m_engine->watchHandler()->findItem(item->iname);
if (QTC_GUARD(it))
it->model()->fetchMore(it->index());
}
}
}
void collapseNode(const QModelIndex &idx)
@@ -276,22 +287,6 @@ public:
m_expandedINames.remove(idx.data(LocalsINameRole).toString());
}
void fetchMore(const QModelIndex &idx) override
{
if (!idx.isValid())
return;
auto item = dynamic_cast<ToolTipWatchItem *>(itemForIndex(idx));
if (!item)
return;
QString iname = item->iname;
if (!m_engine)
return;
WatchItem *it = m_engine->watchHandler()->findItem(iname);
QTC_ASSERT(it, return);
it->model()->fetchMore(it->index());
}
void restoreTreeModel(QXmlStreamReader &r);
QPointer<DebuggerEngine> m_engine;

View File

@@ -38,12 +38,6 @@ using namespace Utils;
namespace Debugger::Internal {
static QString currentError()
{
int err = errno;
return QString::fromLatin1(strerror(err));
}
Terminal::Terminal(QObject *parent)
: QObject(parent)
{
@@ -52,6 +46,10 @@ Terminal::Terminal(QObject *parent)
void Terminal::setup()
{
#ifdef DEBUGGER_USE_TERMINAL
const auto currentError = [] {
int err = errno;
return QString::fromLatin1(strerror(err));
};
if (!qtcEnvironmentVariableIsSet("QTC_USE_PTY"))
return;

View File

@@ -25,6 +25,7 @@ public:
QString m_displayName;
bool m_readOnly = false;
bool m_temporarilyReadOnly = false;
bool m_isAdditionalTabDisabled = false;
QString m_settingsSuffix;
};
@@ -82,6 +83,16 @@ bool ICodeStylePreferences::isTemporarilyReadOnly() const
return d->m_temporarilyReadOnly;
}
bool ICodeStylePreferences::isAdditionalTabDisabled() const
{
return d->m_isAdditionalTabDisabled;
}
void ICodeStylePreferences::setIsAdditionalTabDisabled(bool on)
{
d->m_isAdditionalTabDisabled = on;
}
void ICodeStylePreferences::setTabSettings(const TabSettings &settings)
{
if (d->m_tabSettings == settings)

View File

@@ -40,6 +40,9 @@ public:
bool isTemporarilyReadOnly() const;
void setTemporarilyReadOnly(bool on);
bool isAdditionalTabDisabled() const;
void setIsAdditionalTabDisabled(bool on);
void setTabSettings(const TabSettings &settings);
TabSettings tabSettings() const;
TabSettings currentTabSettings() const;

View File

@@ -131,7 +131,7 @@ def __createProjectHandleQtQuickSelection__(minimumQtVersion):
selectFromCombo(comboBox, minimumQtVersion)
except:
t,v = sys.exc_info()[:2]
test.fatal("Exception while trying to select Qt version", "%s :%s" % (t.__name__, str(v)))
test.fatal("Exception while trying to select Qt version", "%s: %s" % (t.__name__, str(v)))
clickButton(waitForObject(":Next_QPushButton"))
return minimumQtVersion

View File

@@ -12,10 +12,10 @@ import subprocess;
import sys
import errno;
from datetime import datetime,timedelta;
try:
import __builtin__ # Python 2
except ImportError:
import builtins as __builtin__ # Python 3
if sys.version_info.major > 2:
import builtins as __builtin__
else:
import __builtin__
srcPath = ''
@@ -382,6 +382,7 @@ def copySettingsToTmpDir(destination=None, omitFiles=[]):
substituteUnchosenTargetABIs(tmpSettingsDir)
SettingsPath = ['-settingspath', '"%s"' % tmpSettingsDir]
test.log("Test is running on Python %s" % sys.version)
# current dir is directory holding qtcreator.py
origSettingsDir = os.path.abspath(os.path.join(os.getcwd(), "..", "..", "settings"))

View File

@@ -36,7 +36,7 @@ def checkQtCreatorHelpVersion(expectedVersion):
helpContentWidget = waitForObject(':Qt Creator_QHelpContentWidget', 5000)
waitFor("any(map(rightStart, dumpItems(helpContentWidget.model())))", 10000)
items = dumpItems(helpContentWidget.model())
test.compare(filter(rightStart, items)[0],
test.compare(list(filter(rightStart, items))[0],
'Qt Creator Manual %s' % expectedVersion,
'Verifying whether manual uses expected version.')
except: