Utils: postpone combo box handling of the info bar

We might want to remove the info bar in the callback. This makes sure
that all direct connections are handled before removing the info bar
and the combo box gets deleted.

Change-Id: Icfce358d69923fa0558d48c2513e1cfff4926ed9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2022-03-23 10:11:03 +01:00
parent be0b962ce8
commit d70150818f

View File

@@ -322,9 +322,9 @@ void InfoBarDisplay::update()
cb->addItem(comboInfo.displayText, comboInfo.data);
if (info.m_currentComboIndex >= 0 && info.m_currentComboIndex < cb->count())
cb->setCurrentIndex(info.m_currentComboIndex);
connect(cb, QOverload<int>::of(&QComboBox::currentIndexChanged), [cb, info]() {
connect(cb, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [cb, info]() {
info.m_comboCallBack({cb->currentText(), cb->currentData()});
});
}, Qt::QueuedConnection);
hbox->addWidget(cb);
}