There are cases where the platform plugin needs to block and check if Qt 
accepts an event or not:

-  ShortcutOverride:  tryHandleShortcutEvent is synchronous (uses 
QGuiApplicationPrivate:: shortcutMap directly) and returns a bool.

- CloseEvent: The platform needs to know if Qt cancels the close.

- The general "embedded Qt" case: Qt is a view embedded in an application. Key 
and mouse events should be propagated to the the application if Qt does not 
accept them.

We can already flush the event queue by calling flushWindowSystemEvents(), but 
getting the accepted status is not possible.

Proposal: (for dev/5.2)
- Add "bool accepted" to WindowSystemEvent.
- Make all QWindowSystemInterface::handleFooEvent functions return a 
WindowSystemEvent pointer.
- The returned WindowSystemEvent is owned by QWindowSystemInterface and will be 
deleted "later".
- Make all QGuiApplicationPrivate::processFooEvent functions set the accepted 
status.
- All events should go through 
QWindowSystemInterfacePrivate::handleWindowSystemEvent. Don't call 
QGuiApplication directly.

The pattern for getting the accepted status then becomes:

QWindowSystemInterface::WindowSystemEvent *event = 
QWindowSystemInterface::handleFooEvent(…)
QWindowSystemInterface::flushWindowSystemEvents();
// use event->accepted immediately after calling flushWindowSystemEvents();

Morten

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to