[Development] Handling specific platform events in Qt

Alan Alpert 416365416c at gmail.com
Sat Jun 29 01:40:26 CEST 2013


On Fri, Jun 28, 2013 at 2:52 PM, Tomasz Olszak <olszak.tomasz at gmail.com> wrote:
> 2013/6/28 Alan Alpert <416365416c at gmail.com>
>>
>> On Fri, Jun 28, 2013 at 3:23 AM, Friedemann Kleint
>> <Friedemann.Kleint at digia.com> wrote:
>> > Hi,
>> >
>> > QApplicationStateChangeEvent and enumeration Qt::ApplicationState are
>> > intended for this purpose. Feel free to propose additional states if
>> > they are not sufficient for your purposes.
>> >
>> > On the QPA side, they are triggered by
>> > QWindowSystemInterface::handleApplicationStateChanged().
>> >
>> > I can't be sure whether this is accessible by QML, currently?
>>
>> This should be accessible via Qt.application.active (false if
>> paused/minimized or otherwise not visible).
>>
>> --
>> Alan Alpert
>> _______________________________________________
>> Development mailing list
>> Development at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
>
>
> Hi,
> Alan you are right, from QML side Qt.application.active is just enough.
> However I would like to ask for advice regarding where should I handle
> events.
> I have some callback handler from which I could create and send
> QApplicationStateChangeEvent. Additionally when I receive RESUME event then
> top level window should be raised(It goes background when e.g. hardware
> button is clicked).
>
> So question are:
> 1. Where should I put the code which will handle receiving events from Tizen
> and propagate them to Qt?
> 2. Where should I put code which will handle RESUME (in our case not
> Qt::ApplicationSuspended) event:
>
> QWindow *w = qGuiApp->topLevelWindows().at(0);
>
> if (w) {
>
>     w->showNormal();
>
>     w->raise();
>
>     w->requestActivate();
>
> }
>
>
> In the first case I thought about QXcbIntegration, in the second:
>
> QXcbIntegration (add hooks to xcb integration) - Tizen uses xcb platform
> plugin.
> QQmlApplicationEngine
> QXcbWindow
>

Definitely not at the QQmlApplicationEngine level, this needs to be
implemented on the QApplication level so that all Qt applications
benefit.

But I'm really not sure how this should be handled for the variety of
xcb-based platforms, probably in QXcbIntegration? I know that for
Blackberry we can do it in the QNX platform plugin...

--
Alan Alpert



More information about the Development mailing list