Skip to content

Commit 904defc

Browse files
m0dBm0dB
authored andcommitted
comment
1 parent b67099b commit 904defc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/controllers/legacycontrollersettings.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ QWidget* LegacyControllerBooleanSetting::buildInputWidget(QWidget* pParent) {
155155
// We want to format the checkbox label with html styles. This is not possible
156156
// so we attach a separate QLabel and, in order to get a clickable label like
157157
// with QCheckBox, we associate the label with the checkbox (buddy).
158-
// When the label is clicked we toggle the checkbox in eventFilter().
158+
// When the label is clicked we toggle the checkbox in the function
159+
// eventFilter() of helper class ToggleCheckboxEventFilter.
159160
auto pLabelWidget = make_parented<QLabel>(pWidget);
160161
pLabelWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
161162
pLabelWidget->setText(label());
@@ -187,6 +188,11 @@ bool LegacyControllerBooleanSetting::match(const QDomElement& element) {
187188

188189
bool LegacyControllerBooleanSetting::ToggleCheckboxEventFilter::eventFilter(
189190
QObject* pObj, QEvent* pEvent) {
191+
// eventFilter was a method of LegacyControllerBooleanSetting, but this
192+
// doesn't work, as LegacyControllerBooleanSetting is created from a
193+
// different thread, and Qt cannot filter events for objects in a
194+
// different thread.
195+
190196
QLabel* pLabel = qobject_cast<QLabel*>(pObj);
191197
if (pLabel && pEvent->type() == QEvent::MouseButtonPress) {
192198
QCheckBox* pCheckBox = qobject_cast<QCheckBox*>(pLabel->buddy());

0 commit comments

Comments
 (0)