|
|
Hi,
in my application I call during long running computations qApp->processEvents
to update the visualization (e.g. to update an OpenGL widget). But I need to
avoid that the user accesses the QMainWindow widget (especially the menu bar)
and interacts with a QListView widget (that shows an explorer-like structure).
I've installed a global event filter for qApp to stop all Accel and
AccelOverride events. This works so far.
I've also installed event filters on my instances of subclasses of QMainWindow
and QListView to filter out the mouse events. But this does not work at all.
Those two event filters don't see the mouse events, but somehow they still
react to them (popup menu's show up, etc.). The event filter looks as follows:
bool MyQMainWindowEventFilter::eventFilter (QObject* o, QEvent* e)
{
if (some_flag)
{
cout << "mainwindow event during callback, ";
// ignore all mouse events
if ((e->type() == QEvent::MouseButtonPress) ||
(e->type() == QEvent::MouseButtonRelease) ||
(e->type() == QEvent::MouseButtonDblClick) ||
(e->type() == QEvent::MouseMove))
{
cout << "mouse event, killed" << endl;
return true;
}
else
cout << "other event, type " << e->type() << ", passed" << endl;
}
// return false to let the key event pass the filter
return false;
}
I see e.g. FocusIn, FocusOut, Paint, Show and Hide events, but no mouse events
at all. Maybe my understanding of the Qt event mechanism is wrong ...
Simply disabling all mouse events in a global event filter is not an option
since I want to receive mouse events for other widgets, e.g. the OpenGL widget.
Regards,
Joachim
--
List archive and information: http://lists.trolltech.com/qt-interest/
|
|