[Development] Fwd: [Interest] QAbstractEventDispatcher

Phil Hannent phil at hannent.co.uk
Mon Sep 16 15:17:10 CEST 2013


Good afternoon,

Thiago, thank you for your continued advice. I am slowly getting to
understand the two dispatchers.

I have figured out that the two examples whilst on the surface look
like they have different code actually contain very similar data
structures for containing the data:

QTimerInfo == WinTimerInfo
g_source_add_poll == doWsaAsyncSelect
GPollFDWithSocketNotifier = QSockNot
GSocketNotiferSource == QSNDict
g_source_remove_poll == doWsaAsyncSelect

Where things start to get a little grey is with:

g_main_context_iteration == DispatchMessage

It seems to me (please correct me if I am wrong) that I cannot do away
with the GMainContext and functions like g_main_context_iteration
because they have functions which setup the function calls that are
used (for example in qeventdispatcher_glib.cpp, Ln 335):

g_source_set_can_recurse(&socketNotifierSource->source, true);
g_source_attach(&socketNotifierSource->source, mainContext);

It seems that I have to have a flag to indicate if the Socket or Timer
is glib or Win32 and then process that based on that flag, so in
processEvents I can then have an if for that flags.

Any advice would be greatly appreciated.


On 11 September 2013 15:43, Thiago Macieira <thiago.macieira at intel.com> wrote:
> On quarta-feira, 11 de setembro de 2013 11:19:29, Phil Hannent wrote:
>> Good morning,
>>
>> I am attempting to use a Glib based library with Qt, it works
>> perfectly on Linux but on windows the application locks up.
>>
>> I have gotten as far as realising that I need to use the
>> QAbstractEventDispatcher, that the qeventdispatcher_glib.cpp and
>> qeventdispatcher_win.cpp provide good examples.
>>
>> It seems to me however that I need most of qeventdispatcher_glib.cpp
>> and just to insert the calls required for my library to interact with
>> the system. Is that a fair statement or would that be overkill for
>> reimplementing my own QEventDispatcher?
>
> You need to write a qeventdispatcher_glib_win.cpp. The one that exists is a
> Unix-only dispatcher. In particular, you need to provide registering of
> Windows events (see QWinEventNotifier).
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>



More information about the Development mailing list