Why scrolling QScrollArea stops when cursor reaches disabled QCheckBox?
Solved
General and Desktop
-
Enabled QCheckBox can be scrolled past without a problem. I implented wheelEvent on my QComboBox class to ignore it = let parent do the scrolling. Neither wheelEvent or mouseMoveEvent on QCheckBox handle any scrolling and reimplementing them makes no difference.
I tried to filter wheel events this way, but QCheckBox is no longer even drawn.
bool event(QEvent *e) { if(QEvent::Wheel == e->type()) { e->ignore(); } else e->accept(); return false; }
How can I make mouse wheel events always be passed to the parent QScrollArea?
-
Don't always return
false
. Returningfalse
means "I don't care about this event". This means you're discarding all events that come to the checkbox, which includes paintng, resizes etc. That's not what you want.Instead discard only the wheel event and call base implementation otherwise:
bool event(QEvent* e) { if (QEvent::Wheel == e->type()) return false; return QCheckBox::event(e); }