[Interest] QAbstractEventDispatcher

Thiago Macieira thiago.macieira at intel.com
Thu Sep 5 17:30:38 CEST 2013


On quinta-feira, 5 de setembro de 2013 10:43:31, Phil Hannent wrote:
> Good morning,
> 
> I am trying to implement my own event loop. I am trying to use
> libpurple which uses glib with a Qt application I am developing [1].
> On Linux the application runs fine. On windows the application is
> unstable and will freeze. Working on the assumption that the Windows
> version of Qt is not using the glib eventloop I set about
> re-implementing the event loop using the QAbstractEventDispatcher.

Your assumption is correct. We don't use glib on Windows. We don't even search 
for it.

> 2, There is a lack of good examples regarding Qt and 3rd party glib
> implementations for which I believe the class was designed for.

There are less than 10 people in the world that need to implement event 
dispatchers, including the people who wrote the ones in Qt. That's why it's 
not very documented: too much effort for too little gain.

It's best just to read the code for the existing glib and Windows dispatchers 
and ask questions here and in dev at . We'll do what we can to help.

> I was ploughing ahead with it anyway on the basis that it would be a
> good exercise, however I am getting lost. Such as the registerTimer
> function [2], where is the timerId value from? I am using my own Id's
> so could I clash?

> [2]
> http://harmattan-dev.nokia.com/docs/library/html/qt4/qabstracteventdispatch
> er.html#registerTimer-2

Updated links:
http://qt-project.org/doc/qt-5.1/qtcore/qabstracteventdispatcher.html#registerTimer-4
http://qt-project.org/doc/qt-4.8/qabstracteventdispatcher.html#registerTimer-2

The ID is allocated by the non-virtual overload, which then calls the virtual 
one. That is, QObject::startTimer calls this function:

int QAbstractEventDispatcher::registerTimer(int interval, Qt::TimerType 
timerType, QObject *object)
{
    int id = QAbstractEventDispatcherPrivate::allocateTimerId();
    registerTimer(id, interval, timerType, object);
    return id;
}

[Qt 5 code; in Qt 4, there's no timer type]

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130905/4bb717e3/attachment.sig>


More information about the Interest mailing list