wxCheckListBox::Check() should not emit any event under wxQt

In fact, this is the documented behaviour and also what the other ports
are currently doing.
This commit is contained in:
ali kettab 2022-10-31 08:53:27 +01:00 committed by Vadim Zeitlin
parent 23db0483af
commit 1d12873751

View file

@ -80,8 +80,13 @@ bool wxCheckListBox::IsChecked(unsigned int n) const
void wxCheckListBox::Check(unsigned int n, bool check )
{
// Prevent the emission of wxEVT_CHECKLISTBOX event by temporarily block all
// signals on m_qtListWidget object. QSignalBlocker can be used instead when
// Qt 5.3 becomes the minimum supprted version.
const bool wasBlocked = m_qtListWidget->blockSignals(true);
QListWidgetItem* item = m_qtListWidget->item(n);
wxCHECK_RET(item != nullptr, wxT("wrong listbox index") );
return item->setCheckState(check ? Qt::Checked : Qt::Unchecked);
item->setCheckState(check ? Qt::Checked : Qt::Unchecked);
m_qtListWidget->blockSignals(wasBlocked);
}