[Qt-interest] WheelEvent propagation
Oliver Demetz
forenbeitraege at oliverdemetz.de
Thu Aug 20 11:08:37 CEST 2009
Hi again,
I have just found another detail (a bug?) concerning the problem.
In contrast to what I wrote, it is the case that the wheelEvent handler
of the MainWidget gets the wheel event IN EVERY CASE.
The problem is the statement
if(m_view.underMouse())
which is *false* if I clicked the first the menu and then on the view!
So again:
Doing as follows :
1. click button with menu.
->menu opens
2. click the graphicsview in order to close the menu
->menu disappears
now, when rolling the mouse wheel with the cursor over the view the
expression
if(m_view.underMouse())
evaluates to FALSE.
Is this a bug?
Regards,
Oliver
Oliver Demetz schrieb:
> Hi,
>
> My MainWidget contains several buttons (with menus) and a subclass of
> QGraphicsView, call it MainView.
>
> I have some functionality associated with the mouse wheel, which has to
> be performed fron the MainWidget class. It shall only be executed if the
> mouse is over the Main View.
>
> Therefore I implemeted:
>
> class MainWidget : public QWidget{
> //...
> protected: void wheelEvent ( QWheelEvent * event )
> {
> if (m_view.underMouse())
> {
> //do the funcitonality
> }
> }
> }
>
> and the view ignores wheel events:
>
> class MainView: public QGraphicsView{
> //...
> protected: void wheelEvent ( QWheelEvent * event )
> {
> event->ignore();
> }
> }
>
> Thsi works perfectly, BUT:
>
> As I said there are QPushButtons in my MainWidget with a menu.
>
> If this menu is open, and if I click into the view in order to close the
> menu, then the wheel funcitonality is not executed.
>
> I was able to track this down, that the wheel event handler of the
> MainView gets the event, but not the wheelevent handler of the MainWidget.
>
> How can thsi be?
> It is just if the menu of a button was open and if I click directly on
> the view then.
>
> If I click somehere else in my MainWidget, move the cursor over the view
> and roll the wheel then,everything works fine.
>
> Thanks in advance
> Olli
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list