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

This commit is contained in:
The Qt Project
2022-11-21 08:57:28 +00:00
9 changed files with 491 additions and 428 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -306,7 +306,9 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
static const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
if (!style)
return;
tweakedOption.palette.setColor(QPalette::ButtonText, color.rgb());
QPalette pal = tweakedOption.palette;
pal.setColor(QPalette::ButtonText, color.rgb());
tweakedOption.palette = pal; // Workaround for QTCREATORBUG-28470
tweakedOption.rect = rect;
painter.setOpacity(color.alphaF());
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);

View File

@@ -163,7 +163,7 @@ void CMakeProject::setupBuildPresets(Internal::PresetsData &presetsData)
TaskHub::requestPopup();
}
const QString &configurePresetName = buildPreset.configurePreset.value();
const QString &configurePresetName = buildPreset.configurePreset.value_or(QString());
buildPreset.environment
= Utils::findOrDefault(presetsData.configurePresets,
[configurePresetName](

View File

@@ -1832,11 +1832,13 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
QList<Breakpoint> v8Breakpoints;
const QVariantList v8BreakpointIdList = breakData.value("breakpoints").toList();
// skip debug break if no breakpoint and we have not done a single step as last
// action - likely stopped in another file with same naming
if (v8BreakpointIdList.isEmpty() && previousStepAction == Continue) {
inferiorStop = false;
continueDebugging(Continue);
if (engine->state() != InferiorStopRequested) {
// skip debug break if no breakpoint and we have not done a single step as
// last action - likely stopped in another file with same naming
if (v8BreakpointIdList.isEmpty() && previousStepAction == Continue) {
inferiorStop = false;
continueDebugging(Continue);
}
}
for (const QVariant &breakpointId : v8BreakpointIdList) {

View File

@@ -115,6 +115,8 @@ public:
reportFailure(msg);
return;
}
if (!m_process->cleanedStdErr().isEmpty())
appendMessage(m_process->cleanedStdErr(), Utils::StdErrFormat);
reportStopped();
});
@@ -124,6 +126,8 @@ public:
cmd.addCommandLineAsArgs(runControl()->commandLine(), CommandLine::Raw);
m_process->setCommand(cmd);
m_process->setWorkingDirectory(runControl()->workingDirectory());
appendMessage("Starting Perf: " + cmd.toUserOutput(), Utils::NormalMessageFormat);
m_process->start();
}

View File

@@ -505,10 +505,15 @@ static QStringList environmentTemplatesPaths()
FilePaths &JsonWizardFactory::searchPaths()
{
static FilePaths m_searchPaths = {Core::ICore::userResourcePath(WIZARD_PATH),
Core::ICore::resourcePath(WIZARD_PATH)};
for (const QString &environmentTemplateDirName : environmentTemplatesPaths())
m_searchPaths << FilePath::fromString(environmentTemplateDirName);
static FilePaths m_searchPaths;
static bool searchPathsInitialized = false;
if (!searchPathsInitialized) {
searchPathsInitialized = true;
m_searchPaths = {Core::ICore::userResourcePath(WIZARD_PATH),
Core::ICore::resourcePath(WIZARD_PATH)};
for (const QString &environmentTemplateDirName : environmentTemplatesPaths())
m_searchPaths << FilePath::fromString(environmentTemplateDirName);
}
return m_searchPaths;
}

View File

@@ -80,8 +80,9 @@ class InterpreterDetailsWidget : public QWidget
{
Q_OBJECT
public:
InterpreterDetailsWidget()
: m_name(new QLineEdit)
InterpreterDetailsWidget(QWidget *parent)
: QWidget(parent)
, m_name(new QLineEdit)
, m_executable(new PathChooser())
{
m_executable->setExpectedKind(PathChooser::ExistingCommand);
@@ -131,7 +132,7 @@ public:
QList<Interpreter> interpreterFrom(const QString &detectionSource) const;
private:
QTreeView m_view;
QTreeView *m_view = nullptr;
ListModel<Interpreter> m_model;
InterpreterDetailsWidget *m_detailsWidget = nullptr;
QPushButton *m_deleteButton = nullptr;
@@ -149,7 +150,7 @@ private:
};
InterpreterOptionsWidget::InterpreterOptionsWidget()
: m_detailsWidget(new InterpreterDetailsWidget())
: m_detailsWidget(new InterpreterDetailsWidget(this))
, m_defaultId(PythonSettings::defaultInterpreter().id)
{
m_model.setDataAccessor([this](const Interpreter &interpreter, int column, int role) -> QVariant {
@@ -180,23 +181,17 @@ InterpreterOptionsWidget::InterpreterOptionsWidget()
});
m_model.setAllData(PythonSettings::interpreters());
m_view.setModel(&m_model);
m_view.setHeaderHidden(true);
m_view.setSelectionMode(QAbstractItemView::SingleSelection);
m_view.setSelectionBehavior(QAbstractItemView::SelectItems);
auto addButton = new QPushButton(Tr::tr("&Add"));
auto addButton = new QPushButton(Tr::tr("&Add"), this);
m_deleteButton = new QPushButton(Tr::tr("&Delete"));
m_deleteButton = new QPushButton(Tr::tr("&Delete"), this);
m_deleteButton->setEnabled(false);
m_makeDefaultButton = new QPushButton(Tr::tr("&Make Default"));
m_makeDefaultButton->setEnabled(false);
m_cleanButton = new QPushButton(Tr::tr("&Clean Up"));
m_cleanButton = new QPushButton(Tr::tr("&Clean Up"), this);
m_cleanButton->setToolTip(Tr::tr("Remove all Python interpreters without a valid executable."));
updateCleanButton();
m_detailsWidget->hide();
m_view = new QTreeView(this);
Column buttons {
addButton,
@@ -207,10 +202,19 @@ InterpreterOptionsWidget::InterpreterOptionsWidget()
};
Column {
Row { &m_view, buttons },
Row { m_view, buttons },
m_detailsWidget
}.attachTo(this);
updateCleanButton();
m_detailsWidget->hide();
m_view->setModel(&m_model);
m_view->setHeaderHidden(true);
m_view->setSelectionMode(QAbstractItemView::SingleSelection);
m_view->setSelectionBehavior(QAbstractItemView::SelectItems);
connect(addButton, &QPushButton::pressed, this, &InterpreterOptionsWidget::addItem);
connect(m_deleteButton, &QPushButton::pressed, this, &InterpreterOptionsWidget::deleteItem);
connect(m_makeDefaultButton, &QPushButton::pressed, this, &InterpreterOptionsWidget::makeDefault);
@@ -218,7 +222,7 @@ InterpreterOptionsWidget::InterpreterOptionsWidget()
connect(m_detailsWidget, &InterpreterDetailsWidget::changed,
this, &InterpreterOptionsWidget::detailsChanged);
connect(m_view.selectionModel(), &QItemSelectionModel::currentChanged,
connect(m_view->selectionModel(), &QItemSelectionModel::currentChanged,
this, &InterpreterOptionsWidget::currentChanged);
}
@@ -268,7 +272,7 @@ void InterpreterOptionsWidget::currentChanged(const QModelIndex &index, const QM
void InterpreterOptionsWidget::detailsChanged()
{
const QModelIndex &index = m_view.currentIndex();
const QModelIndex &index = m_view->currentIndex();
if (index.isValid()) {
m_model.itemAt(index.row())->itemData = m_detailsWidget->toInterpreter();
emit m_model.dataChanged(index, index);
@@ -288,13 +292,13 @@ void InterpreterOptionsWidget::addItem()
const QModelIndex &index = m_model.indexForItem(
m_model.appendItem({QUuid::createUuid().toString(), QString("Python"), FilePath(), false}));
QTC_ASSERT(index.isValid(), return);
m_view.setCurrentIndex(index);
m_view->setCurrentIndex(index);
updateCleanButton();
}
void InterpreterOptionsWidget::deleteItem()
{
const QModelIndex &index = m_view.currentIndex();
const QModelIndex &index = m_view->currentIndex();
if (index.isValid())
m_model.destroyItem(m_model.itemAt(index.row()));
updateCleanButton();
@@ -411,18 +415,10 @@ public:
mainGroupLayout->addWidget(m_advancedLabel);
mainGroupLayout->addWidget(m_editor->editorWidget(), 1);
setAdvanced(false);
mainGroupLayout->addStretch();
auto advanced = new QCheckBox(Tr::tr("Advanced"));
advanced->setChecked(false);
connect(advanced,
&QCheckBox::toggled,
this,
&PyLSConfigureWidget::setAdvanced);
mainGroupLayout->addWidget(advanced);
m_mainGroup->setLayout(mainGroupLayout);
@@ -434,6 +430,14 @@ public:
m_editor->textDocument()->setPlainText(PythonSettings::pylsConfiguration());
m_mainGroup->setChecked(PythonSettings::pylsEnabled());
updateCheckboxes();
setAdvanced(false);
connect(advanced,
&QCheckBox::toggled,
this,
&PyLSConfigureWidget::setAdvanced);
}
void apply() override
@@ -518,7 +522,7 @@ static PyLSOptionsPage &pylspOptionsPage()
void InterpreterOptionsWidget::makeDefault()
{
const QModelIndex &index = m_view.currentIndex();
const QModelIndex &index = m_view->currentIndex();
if (index.isValid()) {
QModelIndex defaultIndex = m_model.findIndex([this](const Interpreter &interpreter) {
return interpreter.id == m_defaultId;

View File

@@ -445,8 +445,14 @@ Utils::FilePath QmlProjectPlugin::projectFilePath()
{
auto project = ProjectExplorer::SessionManager::startupProject();
const QmlProjectManager::QmlProject *qmlProject = qobject_cast<const QmlProjectManager::QmlProject*>(project);
if (qmlProject)
if (qmlProject) {
return qmlProject->projectFilePath();
} else if (project) {
auto projectFolder = project->rootProjectDirectory();
auto qmlProjectFile = findQmlProject(projectFolder);
if (qmlProjectFile.exists())
return qmlProjectFile;
}
return {};
}