Results 1 to 8 of 8

Thread: How to run a QProcess in QThread without destroying the QThread

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: How to run a QProcess in QThread without destroying the QThread

    In your original code your UI became unresponsive because you blocked the main thread in waitForReadyRead()

    In Qt most I/O is asynchronous for the very purpose of not blocking the main thread

    Also, you don't need a lambda here
    Qt Code:
    1. connect(buttonsearch, &QPushButton::clicked, [this]() {process(); });
    To copy to clipboard, switch view to plain text mode 
    you can directly connect to the process() function
    Qt Code:
    1. connect(buttonsearch, &QPushButton::clicked, this, &mainWindow::process);
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    INeedADollar (8th August 2019)

Similar Threads

  1. Replies: 1
    Last Post: 4th October 2012, 14:49
  2. Starting QProcess from QThread
    By sandeep.theartist in forum Qt Programming
    Replies: 2
    Last Post: 7th June 2012, 06:18
  3. QThread to run one or more QProcess
    By smhall316 in forum Newbie
    Replies: 0
    Last Post: 27th September 2011, 20:39
  4. QThread and QProcess problem
    By codebehind in forum Qt Programming
    Replies: 13
    Last Post: 7th August 2007, 08:11
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

Tags for this Thread

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.