diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-11-01 12:20:21 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-11-03 10:10:58 +0000 |
commit | 07748f540bcb9d507aea8bdef7419027ad0b02ac (patch) | |
tree | 6d7edeaf264849d6ce4f62a8d957788f78067f19 | |
parent | d679c8db821c325bade5652a069dd53b6a070fd7 (diff) |
ProjectExplorer: Fix handling of custom ABIs but AbiWidget
The AbiWidget sometimes lost changes when a custom ABI was used. Fix
that.
Change-Id: I220cc4c6072f0615c645a494130014e0a65d83fe
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/plugins/projectexplorer/abiwidget.cpp | 33 | ||||
-rw-r--r-- | src/plugins/projectexplorer/abiwidget.h | 2 |
2 files changed, 15 insertions, 20 deletions
diff --git a/src/plugins/projectexplorer/abiwidget.cpp b/src/plugins/projectexplorer/abiwidget.cpp index 942e9b55ac..5262ffc66f 100644 --- a/src/plugins/projectexplorer/abiwidget.cpp +++ b/src/plugins/projectexplorer/abiwidget.cpp @@ -88,7 +88,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d->m_architectureComboBox->addItem(Abi::toString(static_cast<Abi::Architecture>(i)), i); d->m_architectureComboBox->setCurrentIndex(static_cast<int>(Abi::UnknownArchitecture)); connect(d->m_architectureComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), - this, &AbiWidget::customAbiChanged); + this, &AbiWidget::updateCustomItemData); QLabel *separator1 = new QLabel(this); separator1->setText(QLatin1String("-")); @@ -111,7 +111,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d->m_osFlavorComboBox = new QComboBox(this); layout->addWidget(d->m_osFlavorComboBox); connect(d->m_osFlavorComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), - this, &AbiWidget::customAbiChanged); + this, &AbiWidget::updateCustomItemData); QLabel *separator3 = new QLabel(this); separator3->setText(QLatin1String("-")); @@ -124,7 +124,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d->m_binaryFormatComboBox->addItem(Abi::toString(static_cast<Abi::BinaryFormat>(i)), i); d->m_binaryFormatComboBox->setCurrentIndex(static_cast<int>(Abi::UnknownFormat)); connect(d->m_binaryFormatComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), - this, &AbiWidget::customAbiChanged); + this, &AbiWidget::updateCustomItemData); QLabel *separator4 = new QLabel(this); separator4->setText(QLatin1String("-")); @@ -139,7 +139,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d->m_wordWidthComboBox->addItem(Abi::toString(0), 0); d->m_wordWidthComboBox->setCurrentIndex(2); connect(d->m_wordWidthComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), - this, &AbiWidget::customAbiChanged); + this, &AbiWidget::updateCustomItemData); layout->setStretchFactor(d->m_abi, 1); @@ -164,24 +164,23 @@ void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi ¤t) defaultAbi = Abi::hostAbi(); } - d->m_abi->addItem(tr("<custom>"), defaultAbi.toString()); + d->m_abi->addItem(tr("<custom>")); d->m_abi->setCurrentIndex(0); + setCustomAbi(defaultAbi); for (int i = 0; i < abiList.count(); ++i) { int index = i + 1; const QString abiString = abiList.at(i).toString(); + d->m_abi->insertItem(index, abiString, abiString); - if (abiList.at(i) == current) + if (abiList.at(i) == defaultAbi) d->m_abi->setCurrentIndex(index); } d->m_abi->setVisible(!abiList.isEmpty()); - if (d->isCustom()) { - if (!current.isValid() && !abiList.isEmpty()) - d->m_abi->setCurrentIndex(1); // default to the first Abi if none is selected. - else - setCustomAbi(current); - } + if (d->isCustom() && !current.isValid() && !abiList.isEmpty()) + d->m_abi->setCurrentIndex(1); // default to the first Abi if none is selected. + modeChanged(); } @@ -215,7 +214,7 @@ void AbiWidget::osChanged() d->m_osFlavorComboBox->addItem(Abi::toString(f), static_cast<int>(f)); d->m_osFlavorComboBox->setCurrentIndex(0); // default to generic flavor } - customAbiChanged(); + updateCustomItemData(); } void AbiWidget::modeChanged() @@ -230,11 +229,8 @@ void AbiWidget::modeChanged() setCustomAbi(currentAbi()); } -void AbiWidget::customAbiChanged() +void AbiWidget::updateCustomItemData() { - if (signalsBlocked()) - return; - Abi current(static_cast<Abi::Architecture>(d->m_architectureComboBox->currentIndex()), static_cast<Abi::OS>(d->m_osComboBox->currentIndex()), static_cast<Abi::OSFlavor>(d->m_osFlavorComboBox->itemData(d->m_osFlavorComboBox->currentIndex()).toInt()), @@ -265,8 +261,7 @@ void AbiWidget::setCustomAbi(const Abi ¤t) break; } } - if (d->isCustom()) - d->m_abi->setItemData(0, current.toString()); + updateCustomItemData(); } emit abiChanged(); diff --git a/src/plugins/projectexplorer/abiwidget.h b/src/plugins/projectexplorer/abiwidget.h index 55a27134e0..dff42068fc 100644 --- a/src/plugins/projectexplorer/abiwidget.h +++ b/src/plugins/projectexplorer/abiwidget.h @@ -57,7 +57,7 @@ signals: private: void osChanged(); void modeChanged(); - void customAbiChanged(); + void updateCustomItemData(); void setCustomAbi(const Abi &a); |