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

Reviewed-by: Tobias Hunger
Task-number: QTCREATORBUG-1877
This commit is contained in:
con
2010-10-06 11:15:01 +02:00
parent 0078bb0802
commit 89e66d7042
4 changed files with 25 additions and 2 deletions

View File

@@ -229,7 +229,8 @@ void PanelsWidget::addPanelWidget(IPropertiesPanel *panel, int row)
ProjectWindow::ProjectWindow(QWidget *parent)
: QWidget(parent),
m_currentWidget(0)
m_currentWidget(0),
m_previousTargetSubIndex(-1)
{
ProjectExplorer::SessionManager *session = ProjectExplorerPlugin::instance()->session();
@@ -375,11 +376,19 @@ void ProjectWindow::showProperties(int index, int subIndex)
// Set up custom panels again:
int pos = 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 (subIndex == 0) {
// Targets page
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->setCurrentWidget(m_currentWidget);
}