How can I use Qt5 in my own mainloop?



  • before, using Qt4 I had installed a hook on X Display such as (from InitQtEvents()) :

    @static QApplication* QtApp;

    Display*
    HookXDpy (XDpy* xd, XEventProc p)
    {
    if (!xd)
    xd = XDefaultDpy;
    if (!xd)
    return 0;
    xd->evproc = p;
    return xd->dpy;
    }

    static void
    HandleXDpyEvents (XEvent* event)
    {
    QtApp->x11ProcessEvent (event);
    }

    void
    InitQtEvents ()
    {
    Display* dpy;

    if (QtApp)
    return;

    /* Qt app creation, with our own X11 server connection so that
    we can handle the connection in our main loop
    */
    dpy = HookXDpy (0, HandleXDpyEvents);
    QtApp = new QApplication (dpy);
    }
    @

    I had created the hook and give the X11 connection to Qt4 application and then process XEvent.

    How can i do this in Qt5 ?

    because it seems that QXcbEventReader opens a connection on the same X11 socket (IN another thread) AND eats every xevent ! to send them back to it-self as PostedEvents !

    What should I do now to get all xevent in my own mainloop and process them to my QApplication?

    I haved already tried to:

    • reimplemented QcoreApplication::notify() but I don't receive any native Events when i try to resize my QFrame .. and it also doesn't repaint itself anymore.
    • added NativeEventFilter and EventFilter on my QApp but it's the same as above ... I do not receive any interesting events

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I'd advise to bring that question to the interest mailing list. You'll find there Qt's maintainers/developers (this forum is more user oriented)



  • Thank you for the advise
    I will try this opttion :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.