Results 1 to 5 of 5

Thread: QT/C++ GUI misconception

  1. #1
    Join Date
    Nov 2015
    Posts
    67

    Default QT/C++ GUI misconception

    I found no answer for this Problem in C++/Qt on the internet:

    command1
    different command
    different command
    different command
    .
    .
    .
    like 1000 different commands
    .
    .
    .
    different command



    No Loop. How does the GUI stay responsive, while this intensive processing??? You cannot write after every command a qWait or a processEvents()

    I only found answers like put a qwait there put a processEvent there and hope it works. Which it clearly does not if there is no loop around it like in my example.

    Is it a misconception of C++/Qt?

    Why should somebody not want responsive GUI? In this case its not possible in c++ is it?

    I think my example is very clear, I hope for simple answers
    Last edited by Ini; 21st March 2016 at 15:53.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QT/C++ GUI misconception

    If you have a long running task that cannot be split into smaller subtasks which could be run in sequence, then you can put the into a different execution context, e.g. a thread or child process.

    Cheers,
    _

  3. #3
    Join Date
    Nov 2015
    Posts
    67

    Default Re: QT/C++ GUI misconception

    So I would need to continue in the thread that gives the commands to the thread where the GUI is, after painting in the GUI is done to be synchron right?

    like
    thread1: command paint someting in GUI thread
    GUI threads paints
    thread1 should continue processing only after painting finsihed

    is that automatically the case? or do I need to add code for that

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QT/C++ GUI misconception

    That always depends on the task at hand.

    Sometimes the long processing has a result, sometimes it has many intermediate results, it could have progress reporting or not, etc.

    it always depends on the use case.

    Cheers,
    _

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT/C++ GUI misconception

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.