QComboBox, part of simple QDialog, wrapped in a QGraphicsProxyWidget, does not respond to mouse wheel events

StackOverflow https://stackoverflow.com/questions/16917593

سؤال

I have a simple QDialog, containing only a QComboBox and a QPlainTextEdit, contained by a QGraphicsProxyWidget. Usually, a focused QComboBox responds to wheelEvents, changing its currentIndex. However, in this QGraphicsProxyWidget, there is no response whatsoever.

As an experiment, I've also tried catching the wheelEvent, either in QComboBox, or in the QGraphicsProxyWidget, but it too is never called.

How can I get the embedded QComboBox to respond to mouse wheel events? First prize if you know how to have it responding to mouse events when the popup list is shown.

هل كانت مفيدة؟

المحلول

If it was working, the path with which the event would be propagated is:

QGraphicsView::wheelEvent

QGraphicsScene::wheelEvent

QGraphicsWidget::sceneEvent (the proxy widget's parent class)

QGraphicsItem::sceneEvent(the proxy widget's parent's parent)

QGraphicsProxyWidget::wheelEvent

QComboBox::wheelEvent

You already know it's not getting as far as QGraphicsProxyWidget::wheelEvent, so if I were you I would go further up the chain to find where it's getting stuck.

Are you overriding wheelEvent anywhere else, like in QGraphicsView or QGraphicsScene? If so, that's probably the source of your problem, since these classes are supposed to forward events to their children.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top