Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I use Qt5 in my own mainloop?
Forum Updated to NodeBB v4.3 + New Features

How can I use Qt5 in my own mainloop?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shamok
    wrote on last edited by
    #1

    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
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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)

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shamok
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved