diff --git a/src/qt/checklst.cpp b/src/qt/checklst.cpp index 3411ef59f6..255dc0a65b 100644 --- a/src/qt/checklst.cpp +++ b/src/qt/checklst.cpp @@ -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); }