Commit 5897cd1f authored by Tobias Hunger's avatar Tobias Hunger

AbiWidget: Use QSignalBlocker

Use QSignalBlocker instead of blocking/unblocking manually.

Change-Id: I7b5c04bd256caee9e20b353392eda49a301137e3
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 21b0e7c3
......@@ -153,7 +153,7 @@ AbiWidget::~AbiWidget()
void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi &current)
{
bool blocked = blockSignals(true);
QSignalBlocker blocker(this);
d->m_abi->clear();
Abi defaultAbi = current;
......@@ -183,8 +183,6 @@ void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi &current)
setCustomAbi(current);
}
modeChanged();
blockSignals(blocked);
}
QList<Abi> AbiWidget::supportedAbis() const
......@@ -208,14 +206,15 @@ Abi AbiWidget::currentAbi() const
void AbiWidget::osChanged()
{
bool blocked = d->m_osFlavorComboBox->blockSignals(true);
d->m_osFlavorComboBox->clear();
Abi::OS os = static_cast<Abi::OS>(d->m_osComboBox->itemData(d->m_osComboBox->currentIndex()).toInt());
QList<Abi::OSFlavor> flavors = Abi::flavorsForOs(os);
foreach (Abi::OSFlavor f, flavors)
d->m_osFlavorComboBox->addItem(Abi::toString(f), static_cast<int>(f));
d->m_osFlavorComboBox->setCurrentIndex(0); // default to generic flavor
d->m_osFlavorComboBox->blockSignals(blocked);
{
QSignalBlocker blocker(d->m_osFlavorComboBox);
d->m_osFlavorComboBox->clear();
Abi::OS os = static_cast<Abi::OS>(d->m_osComboBox->itemData(d->m_osComboBox->currentIndex()).toInt());
QList<Abi::OSFlavor> flavors = Abi::flavorsForOs(os);
foreach (Abi::OSFlavor f, flavors)
d->m_osFlavorComboBox->addItem(Abi::toString(f), static_cast<int>(f));
d->m_osFlavorComboBox->setCurrentIndex(0); // default to generic flavor
}
customAbiChanged();
}
......@@ -248,26 +247,27 @@ void AbiWidget::customAbiChanged()
void AbiWidget::setCustomAbi(const Abi &current)
{
bool blocked = blockSignals(true);
d->m_architectureComboBox->setCurrentIndex(static_cast<int>(current.architecture()));
d->m_osComboBox->setCurrentIndex(static_cast<int>(current.os()));
osChanged();
for (int i = 0; i < d->m_osFlavorComboBox->count(); ++i) {
if (d->m_osFlavorComboBox->itemData(i).toInt() == current.osFlavor()) {
d->m_osFlavorComboBox->setCurrentIndex(i);
break;
{
QSignalBlocker blocker(this);
d->m_architectureComboBox->setCurrentIndex(static_cast<int>(current.architecture()));
d->m_osComboBox->setCurrentIndex(static_cast<int>(current.os()));
osChanged();
for (int i = 0; i < d->m_osFlavorComboBox->count(); ++i) {
if (d->m_osFlavorComboBox->itemData(i).toInt() == current.osFlavor()) {
d->m_osFlavorComboBox->setCurrentIndex(i);
break;
}
}
}
d->m_binaryFormatComboBox->setCurrentIndex(static_cast<int>(current.binaryFormat()));
for (int i = 0; i < d->m_wordWidthComboBox->count(); ++i) {
if (d->m_wordWidthComboBox->itemData(i).toInt() == current.wordWidth()) {
d->m_wordWidthComboBox->setCurrentIndex(i);
break;
d->m_binaryFormatComboBox->setCurrentIndex(static_cast<int>(current.binaryFormat()));
for (int i = 0; i < d->m_wordWidthComboBox->count(); ++i) {
if (d->m_wordWidthComboBox->itemData(i).toInt() == current.wordWidth()) {
d->m_wordWidthComboBox->setCurrentIndex(i);
break;
}
}
if (d->isCustom())
d->m_abi->setItemData(0, current.toString());
}
if (d->isCustom())
d->m_abi->setItemData(0, current.toString());
blockSignals(blocked);
emit abiChanged();
}
......
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