Merge remote-tracking branch 'origin/9.0'

Change-Id: Idd9c2b1bf787040b7b415b7cda29035227ca1011
This commit is contained in:
Eike Ziller
2022-11-21 08:57:14 +01: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()); static const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
if (!style) if (!style)
return; 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; tweakedOption.rect = rect;
painter.setOpacity(color.alphaF()); painter.setOpacity(color.alphaF());
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter); style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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