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();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
m_title = title;
|
||||
@@ -104,10 +111,6 @@ void DoubleTabWidget::addTab(const QString &name, const QStringList &subTabs)
|
||||
tab.subTabs = subTabs;
|
||||
tab.currentSubTab = tab.subTabs.isEmpty() ? -1 : 0;
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -118,10 +121,7 @@ void DoubleTabWidget::insertTab(int index, const QString &name, const QStringLis
|
||||
tab.subTabs = subTabs;
|
||||
tab.currentSubTab = tab.subTabs.isEmpty() ? -1 : 0;
|
||||
m_tabs.insert(index, tab);
|
||||
if (m_currentIndex == -1) {
|
||||
m_currentIndex = index;
|
||||
emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab);
|
||||
} else if (m_currentIndex >= index) {
|
||||
if (m_currentIndex >= index) {
|
||||
++m_currentIndex;
|
||||
emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab);
|
||||
}
|
||||
|
@@ -30,6 +30,8 @@ public:
|
||||
int currentIndex() const;
|
||||
void setCurrentIndex(int index);
|
||||
|
||||
int currentSubIndex() const;
|
||||
|
||||
signals:
|
||||
void currentIndexChanged(int index, int subIndex);
|
||||
|
||||
|
@@ -46,9 +46,7 @@ void TargetSelector::insertTarget(int index, const QString &name)
|
||||
|
||||
m_targets.insert(index, target);
|
||||
|
||||
if (m_currentTargetIndex == -1)
|
||||
setCurrentIndex(index);
|
||||
else if (m_currentTargetIndex >= index)
|
||||
if (m_currentTargetIndex >= index)
|
||||
setCurrentIndex(m_currentTargetIndex + 1);
|
||||
update();
|
||||
}
|
||||
@@ -59,12 +57,13 @@ void TargetSelector::removeTarget(int index)
|
||||
|
||||
m_targets.removeAt(index);
|
||||
|
||||
if (m_currentTargetIndex >= m_targets.count())
|
||||
setCurrentIndex(m_targets.count() - 1);
|
||||
else if (m_currentTargetIndex >= index)
|
||||
// force a signal since the target pointed to has changed:
|
||||
if (m_currentTargetIndex >= m_targets.count()) {
|
||||
setCurrentIndex(-1);
|
||||
} else if (m_currentTargetIndex >= index) {
|
||||
--m_currentTargetIndex;
|
||||
// force a signal since the index has changed
|
||||
emit currentChanged(m_currentTargetIndex, m_targets.at(m_currentTargetIndex).currentSubIndex);
|
||||
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
|
@@ -111,23 +111,25 @@ void TargetSettingsPanelWidget::setupUi()
|
||||
noTargetLayout->addStretch(10);
|
||||
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())
|
||||
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()),
|
||||
this, SLOT(addTarget()));
|
||||
connect(m_selector, SIGNAL(removeButtonClicked()),
|
||||
this, SLOT(removeTarget()));
|
||||
|
||||
updateTargetAddAndRemoveButtons();
|
||||
|
||||
activeTargetChanged(activeTarget);
|
||||
}
|
||||
|
||||
void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subIndex)
|
||||
|
Reference in New Issue
Block a user