Results 1 to 9 of 9

Thread: QProgressDialog stucks

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 140 Times in 132 Posts

    Default Re: QProgressDialog stucks

    don't use waitFor* methods where you don't have to because they are blocking - as their names say - they're just waiting and doing nothing (your whole application is just waiting) until something is done. Create progress dialog on a heap and connect QProcess::finished() with QProgressDialog::close() and don't use waitForFinished() so in between your applicantion can process events.

    P.S. And I'm not sure but you can set WA_DeleteOnClose attribute to the QProgressDialog...
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  2. #2
    Join Date
    Sep 2008
    Posts
    43
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: QProgressDialog stucks

    i dont want to create new slots and staff so ill use the standart system() function

    code ive used but its no working:
    Qt Code:
    1. QProgressDialog progress("Installing Package...", "Cancel", 0, 0, this);
    2. progress.setRange(0,0);
    3. progress.setWindowModality(Qt::WindowModal);
    4. qApp->processEvents();
    5.  
    6. while(progress.exec())
    7. {
    8. system ( InstallPkgCom ); //install package
    9. }
    10.  
    11. progress.close();
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Dec 2006
    Posts
    849
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 163 Times in 151 Posts

    Default Re: QProgressDialog stucks

    during the execution of system() the calling thread "pauses" - you can't show a QProgressDialog nor interact with it during that time. So use QProcess instead.

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

    Default Re: QProgressDialog stucks

    well ive tried to do ti with byconnecting qrocess::finished to QProgressDialog::close()

    but it says:
    Qt Code:
    1. Object::connect: No such signal QProcess::finished()
    To copy to clipboard, switch view to plain text mode 

    heres my code:
    Qt Code:
    1. QProcess *installproc = new QProcess(this);
    2. connect( installproc, SIGNAL(finished()),
    3. this, SLOT(processFinished()) );
    4.  
    5. installproc->start(InstallPkgCom);
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 140 Times in 132 Posts

    Default Re: QProgressDialog stucks

    you can check in docs that it is: void finished ( int exitCode, QProcess::ExitStatus exitStatus )
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  6. #6
    Join Date
    Sep 2008
    Posts
    43
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: QProgressDialog stucks

    thank you all for your help i did it!

    Qt Code:
    1. progress->setLabelText("Removing Package...");
    2. progress->setRange(0,0);
    3. progress->setWindowModality(Qt::WindowModal);
    4.  
    5. QProcess *removeproc = new QProcess(this);
    6. removeproc->start(RemovePkgCom);
    7. connect( removeproc, SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(removeProcessFinished()));
    8.  
    9. progress->exec();
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Busy Indicator using QProgressDialog??
    By qtzcute in forum Qt Programming
    Replies: 13
    Last Post: 6th September 2011, 12:31
  2. How draw border in QProgressDialog?
    By kamlesh.sangani in forum Qt Programming
    Replies: 0
    Last Post: 5th June 2009, 12:32
  3. How to use a file to setup a QProgressDialog, Thanks
    By HelloDan in forum Qt Programming
    Replies: 20
    Last Post: 22nd February 2009, 08:55
  4. Replies: 2
    Last Post: 22nd January 2008, 16:15
  5. How to show QProgressDialog without cancel button
    By rajesh in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2007, 10:53

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.