Commit 89e66d70 authored by con's avatar con
Browse files

Fix annoying behavior that target selector always switched back to "build"

Reviewed-by: Tobias Hunger
Task-number: QTCREATORBUG-1877
parent 0078bb08
...@@ -229,7 +229,8 @@ void PanelsWidget::addPanelWidget(IPropertiesPanel *panel, int row) ...@@ -229,7 +229,8 @@ void PanelsWidget::addPanelWidget(IPropertiesPanel *panel, int row)
ProjectWindow::ProjectWindow(QWidget *parent) ProjectWindow::ProjectWindow(QWidget *parent)
: QWidget(parent), : QWidget(parent),
m_currentWidget(0) m_currentWidget(0),
m_previousTargetSubIndex(-1)
{ {
ProjectExplorer::SessionManager *session = ProjectExplorerPlugin::instance()->session(); ProjectExplorer::SessionManager *session = ProjectExplorerPlugin::instance()->session();
...@@ -375,11 +376,19 @@ void ProjectWindow::showProperties(int index, int subIndex) ...@@ -375,11 +376,19 @@ void ProjectWindow::showProperties(int index, int subIndex)
// Set up custom panels again: // Set up custom panels again:
int pos = 0; int pos = 0;
IPanelFactory *fac = 0; IPanelFactory *fac = 0;
// remember previous sub index state of target settings page
if (TargetSettingsPanelWidget *previousPanelWidget
= qobject_cast<TargetSettingsPanelWidget*>(m_currentWidget)) {
m_previousTargetSubIndex = previousPanelWidget->currentSubIndex();
}
if (project->supportedTargetIds().count() > 1) { if (project->supportedTargetIds().count() > 1) {
if (subIndex == 0) { if (subIndex == 0) {
// Targets page // Targets page
removeCurrentWidget(); removeCurrentWidget();
m_currentWidget = new TargetSettingsPanelWidget(project); TargetSettingsPanelWidget *panelWidget = new TargetSettingsPanelWidget(project);
if (m_previousTargetSubIndex >= 0)
panelWidget->setCurrentSubIndex(m_previousTargetSubIndex);
m_currentWidget = panelWidget;
m_centralWidget->addWidget(m_currentWidget); m_centralWidget->addWidget(m_currentWidget);
m_centralWidget->setCurrentWidget(m_currentWidget); m_centralWidget->setCurrentWidget(m_currentWidget);
} }
......
...@@ -94,6 +94,7 @@ private: ...@@ -94,6 +94,7 @@ private:
QStackedWidget *m_centralWidget; QStackedWidget *m_centralWidget;
QWidget *m_currentWidget; QWidget *m_currentWidget;
QList<ProjectExplorer::Project *> m_tabIndexToProject; QList<ProjectExplorer::Project *> m_tabIndexToProject;
int m_previousTargetSubIndex;
}; };
} // namespace Internal } // namespace Internal
......
...@@ -285,3 +285,13 @@ void TargetSettingsPanelWidget::updateTargetAddAndRemoveButtons() ...@@ -285,3 +285,13 @@ void TargetSettingsPanelWidget::updateTargetAddAndRemoveButtons()
m_selector->setAddButtonEnabled(!m_addMenu->actions().isEmpty()); m_selector->setAddButtonEnabled(!m_addMenu->actions().isEmpty());
m_selector->setRemoveButtonEnabled(m_project->targets().count() > 1); m_selector->setRemoveButtonEnabled(m_project->targets().count() > 1);
} }
int TargetSettingsPanelWidget::currentSubIndex() const
{
return m_selector->currentSubIndex();
}
void TargetSettingsPanelWidget::setCurrentSubIndex(int subIndex)
{
m_selector->setCurrentSubIndex(subIndex);
}
...@@ -57,6 +57,9 @@ public: ...@@ -57,6 +57,9 @@ public:
void setupUi(); void setupUi();
int currentSubIndex() const;
void setCurrentSubIndex(int subIndex);
private slots: private slots:
void currentTargetChanged(int targetIndex, int subIndex); void currentTargetChanged(int targetIndex, int subIndex);
void removeTarget(); void removeTarget();
......
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