Results 1 to 7 of 7

Thread: QThread blocks gui

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QThread blocks gui

    Qt Code:
    1. class Install : public QThread,
    2. public paludis::InstallTask
    3. {
    4. Q_OBJECT
    5. public:
    6. Install(QObject* pobj,
    7. DatabaseView* main,
    8. const paludis::DepListOptions & options,
    9. paludis::tr1::shared_ptr<const paludis::DestinationsSet> destinations);
    10. ~Install() {}
    11. ...
    12.  
    13. };
    To copy to clipboard, switch view to plain text mode 


    I have to be more precise the next time, sorry. I'm using start() for starting the thread. The work is done in Install::run()->execute().
    The problem is, I have to pass a lot of text to a output window like a terminal like the gcc output and a lot more gentoo specific.
    Last edited by jacek; 26th October 2007 at 18:33. Reason: changed [qtclass] to [code]

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QThread blocks gui

    Quote Originally Posted by skoegl View Post
    The problem is, I have to pass a lot of text to a output window like a terminal like the gcc output and a lot more gentoo specific.
    Accessing a widget from a non-GUI thread is a Really Bad Thing(tm). Make sure you use queued connections instead.

  3. The following user says thank you to jacek for this useful post:

    skoegl (27th October 2007)

  4. #3
    Join Date
    Sep 2007
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QThread blocks gui

    @jacek:

    Ok, thanks. I've switched to SIGNAL/SLOT "message passing", and checked it into svn.

    @all:

    I tried with and without sending message (QString) to the main thread. The gui is still blocked while the thread is running. After the job is finished, the Gui is again responsively.

    How can I determine, what's the reason of this block?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QThread blocks gui

    Quote Originally Posted by skoegl View Post
    How can I determine, what's the reason of this block?
    Try setting a breakpoint on QThread::start() to see whether you really start the thread.

Similar Threads

  1. QThread exec proplem to stop...
    By patrik08 in forum Qt Programming
    Replies: 29
    Last Post: 21st May 2007, 07:51
  2. QGraphicsScene and QThread
    By tts80 in forum Qt Programming
    Replies: 5
    Last Post: 10th January 2007, 09:32
  3. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19
  4. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  5. Is it possible to create a QThread without inheriting ?
    By probine in forum Qt Programming
    Replies: 6
    Last Post: 23rd March 2006, 22:51

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
  •  
Qt is a trademark of The Qt Company.