[Development] Fwd: [Interest] QAbstractEventDispatcher

Phil Hannent phil at hannent.co.uk
Wed Sep 11 12:19:29 CEST 2013


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?

Regards
Phil Hannent





---------- Forwarded message ----------
From: Thiago Macieira <thiago.macieira at intel.com>
Date: 5 September 2013 16:30
Subject: Re: [Interest] QAbstractEventDispatcher
To: interest at qt-project.org


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

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130911/4ccd4c1a/attachment.sig>


More information about the Development mailing list