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. Main event loop freezing during time consuming function
Qt 6.11 is out! See what's new in the release blog

Main event loop freezing during time consuming function

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 864 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.
  • D Offline
    D Offline
    Deepfreeze
    wrote on last edited by
    #1

    As I'm working on an application that has quite some functions which are time consuming,
    I quickly found the "article":http://doc.qt.digia.com/qq/qq27-responsive-guis.html

    As the QCoreApplication::processEvents() approach wasn't feasible, I went for
    the option with Qthreads and the local QEventLoop.

    @
    q = new QEventLoop;
    thread = new QThread;
    kinectObject->runOrientation = 1;
    connect(thread, SIGNAL(started()), kinectObject, SLOT(run()));
    connect(kinectObject, SIGNAL(runFinished()), thread, SLOT(quit()));
    connect(kinectObject, SIGNAL(runFinished()), thread, SLOT(deleteLater()));
    connect(kinectObject, SIGNAL(runFinished()), q, SLOT(quit()));
    connect(kinectObject, SIGNAL(runFinished()), q, SLOT(deleteLater()));
    thread->start();
    q->exec();
    @

    Now if my kinectObject slot run() only has a Sleep(5000) in it, the GUI stays
    responsive, but if I place the code that through a boost thread or interface to
    the OpenNI drivers, the GUI becomes irresponsive.

    So my question is to how improve my code such that my GUI stays responsive
    and probably also without using the local QEventLoop? As I understood the local
    eventloop also catches other events like network that should go somewhere else.

    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