Commit 24f12ede authored by dt's avatar dt
Browse files

The Minitargetselector shouldn't set a new startup project

Instead let the project explorer plugin handle that.

Reviewed-By: danimo
parent b68a57b2
...@@ -352,7 +352,7 @@ bool MiniTargetWidget::hasBuildConfiguration() const ...@@ -352,7 +352,7 @@ bool MiniTargetWidget::hasBuildConfiguration() const
} }
MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorAction, QWidget *parent) : MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorAction, QWidget *parent) :
QWidget(parent), m_projectAction(targetSelectorAction) QWidget(parent), m_projectAction(targetSelectorAction), m_ignoreIndexChange(false)
{ {
setProperty("panelwidget", true); setProperty("panelwidget", true);
setContentsMargins(QMargins(0, 1, 1, 8)); setContentsMargins(QMargins(0, 1, 1, 8));
...@@ -471,9 +471,14 @@ void MiniProjectTargetSelector::removeProject(ProjectExplorer::Project* project) ...@@ -471,9 +471,14 @@ void MiniProjectTargetSelector::removeProject(ProjectExplorer::Project* project)
if (index < 0) if (index < 0)
return; return;
ProjectListWidget *plw = qobject_cast<ProjectListWidget*>(m_widgetStack->widget(index)); ProjectListWidget *plw = qobject_cast<ProjectListWidget*>(m_widgetStack->widget(index));
// We don't want to emit a startUpProject changed, even if we remove the current startup project
// The ProjectExplorer takes care of setting a new startup project.
m_ignoreIndexChange = true;
m_projectsBox->removeItem(index); m_projectsBox->removeItem(index);
m_projectsBox->setEnabled(m_projectsBox->count() > 1); m_projectsBox->setEnabled(m_projectsBox->count() > 1);
delete plw; delete plw;
m_ignoreIndexChange = false;
} }
void MiniProjectTargetSelector::addTarget(ProjectExplorer::Target *target, bool activeTarget) void MiniProjectTargetSelector::addTarget(ProjectExplorer::Target *target, bool activeTarget)
...@@ -617,6 +622,8 @@ int MiniProjectTargetSelector::indexFor(ProjectExplorer::Project *project) const ...@@ -617,6 +622,8 @@ int MiniProjectTargetSelector::indexFor(ProjectExplorer::Project *project) const
void MiniProjectTargetSelector::emitStartupProjectChanged(int index) void MiniProjectTargetSelector::emitStartupProjectChanged(int index)
{ {
if (m_ignoreIndexChange)
return;
Project *project = m_projectsBox->itemData(index).value<Project*>(); Project *project = m_projectsBox->itemData(index).value<Project*>();
QTC_ASSERT(project, return;) QTC_ASSERT(project, return;)
emit startupProjectChanged(project); emit startupProjectChanged(project);
......
...@@ -137,6 +137,7 @@ private: ...@@ -137,6 +137,7 @@ private:
QAction *m_projectAction; QAction *m_projectAction;
QComboBox *m_projectsBox; QComboBox *m_projectsBox;
QStackedWidget *m_widgetStack; QStackedWidget *m_widgetStack;
bool m_ignoreIndexChange;
}; };
} // namespace Internal } // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment