forked from qt-creator/qt-creator
Fix parsing canceld on project load
Task-Nr: QTCREATORBUG-1616
This commit is contained in:
@@ -86,6 +86,13 @@ void DoubleTabWidget::setCurrentIndex(int index)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DoubleTabWidget::currentSubIndex() const
|
||||||
|
{
|
||||||
|
if (m_currentIndex >= 0 && m_currentIndex < m_tabs.size())
|
||||||
|
return m_tabs.at(m_currentIndex).currentSubTab;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void DoubleTabWidget::setTitle(const QString &title)
|
void DoubleTabWidget::setTitle(const QString &title)
|
||||||
{
|
{
|
||||||
m_title = title;
|
m_title = title;
|
||||||
@@ -104,10 +111,6 @@ void DoubleTabWidget::addTab(const QString &name, const QStringList &subTabs)
|
|||||||
tab.subTabs = subTabs;
|
tab.subTabs = subTabs;
|
||||||
tab.currentSubTab = tab.subTabs.isEmpty() ? -1 : 0;
|
tab.currentSubTab = tab.subTabs.isEmpty() ? -1 : 0;
|
||||||
m_tabs.append(tab);
|
m_tabs.append(tab);
|
||||||
if (m_currentIndex == -1) {
|
|
||||||
m_currentIndex = m_tabs.size()-1;
|
|
||||||
emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab);
|
|
||||||
}
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,10 +121,7 @@ void DoubleTabWidget::insertTab(int index, const QString &name, const QStringLis
|
|||||||
tab.subTabs = subTabs;
|
tab.subTabs = subTabs;
|
||||||
tab.currentSubTab = tab.subTabs.isEmpty() ? -1 : 0;
|
tab.currentSubTab = tab.subTabs.isEmpty() ? -1 : 0;
|
||||||
m_tabs.insert(index, tab);
|
m_tabs.insert(index, tab);
|
||||||
if (m_currentIndex == -1) {
|
if (m_currentIndex >= index) {
|
||||||
m_currentIndex = index;
|
|
||||||
emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab);
|
|
||||||
} else if (m_currentIndex >= index) {
|
|
||||||
++m_currentIndex;
|
++m_currentIndex;
|
||||||
emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab);
|
emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab);
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,8 @@ public:
|
|||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
void setCurrentIndex(int index);
|
void setCurrentIndex(int index);
|
||||||
|
|
||||||
|
int currentSubIndex() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentIndexChanged(int index, int subIndex);
|
void currentIndexChanged(int index, int subIndex);
|
||||||
|
|
||||||
|
@@ -46,9 +46,7 @@ void TargetSelector::insertTarget(int index, const QString &name)
|
|||||||
|
|
||||||
m_targets.insert(index, target);
|
m_targets.insert(index, target);
|
||||||
|
|
||||||
if (m_currentTargetIndex == -1)
|
if (m_currentTargetIndex >= index)
|
||||||
setCurrentIndex(index);
|
|
||||||
else if (m_currentTargetIndex >= index)
|
|
||||||
setCurrentIndex(m_currentTargetIndex + 1);
|
setCurrentIndex(m_currentTargetIndex + 1);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -59,12 +57,13 @@ void TargetSelector::removeTarget(int index)
|
|||||||
|
|
||||||
m_targets.removeAt(index);
|
m_targets.removeAt(index);
|
||||||
|
|
||||||
if (m_currentTargetIndex >= m_targets.count())
|
if (m_currentTargetIndex >= m_targets.count()) {
|
||||||
setCurrentIndex(m_targets.count() - 1);
|
setCurrentIndex(-1);
|
||||||
else if (m_currentTargetIndex >= index)
|
} else if (m_currentTargetIndex >= index) {
|
||||||
// force a signal since the target pointed to has changed:
|
--m_currentTargetIndex;
|
||||||
|
// force a signal since the index has changed
|
||||||
emit currentChanged(m_currentTargetIndex, m_targets.at(m_currentTargetIndex).currentSubIndex);
|
emit currentChanged(m_currentTargetIndex, m_targets.at(m_currentTargetIndex).currentSubIndex);
|
||||||
|
}
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -111,23 +111,25 @@ void TargetSettingsPanelWidget::setupUi()
|
|||||||
noTargetLayout->addStretch(10);
|
noTargetLayout->addStretch(10);
|
||||||
m_centralWidget->addWidget(m_noTargetLabel);
|
m_centralWidget->addWidget(m_noTargetLabel);
|
||||||
|
|
||||||
connect(m_selector, SIGNAL(currentChanged(int,int)),
|
|
||||||
this, SLOT(currentTargetChanged(int,int)));
|
|
||||||
|
|
||||||
// Save active target now as it will change when targets are added:
|
|
||||||
Target *activeTarget = m_project->activeTarget();
|
|
||||||
|
|
||||||
foreach (Target *t, m_project->targets())
|
foreach (Target *t, m_project->targets())
|
||||||
targetAdded(t);
|
targetAdded(t);
|
||||||
|
|
||||||
|
// Now set the correct target
|
||||||
|
int index = m_targets.indexOf(m_project->activeTarget());
|
||||||
|
m_selector->setCurrentIndex(index);
|
||||||
|
m_selector->setCurrentSubIndex(0);
|
||||||
|
|
||||||
|
currentTargetChanged(index, 0);
|
||||||
|
|
||||||
|
connect(m_selector, SIGNAL(currentChanged(int,int)),
|
||||||
|
this, SLOT(currentTargetChanged(int,int)));
|
||||||
|
|
||||||
connect(m_selector, SIGNAL(addButtonClicked()),
|
connect(m_selector, SIGNAL(addButtonClicked()),
|
||||||
this, SLOT(addTarget()));
|
this, SLOT(addTarget()));
|
||||||
connect(m_selector, SIGNAL(removeButtonClicked()),
|
connect(m_selector, SIGNAL(removeButtonClicked()),
|
||||||
this, SLOT(removeTarget()));
|
this, SLOT(removeTarget()));
|
||||||
|
|
||||||
updateTargetAddAndRemoveButtons();
|
updateTargetAddAndRemoveButtons();
|
||||||
|
|
||||||
activeTargetChanged(activeTarget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subIndex)
|
void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subIndex)
|
||||||
|
Reference in New Issue
Block a user