Results 1 to 4 of 4

Thread: Progress Bar Dialog using threads

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Progress Bar Dialog using threads

    HI,
    I am trying to call Progress bar Dialog using thread from my main gui window but the progress bar does not proceed. Here is the code snippet.

    From main
    ************

    Qt Code:
    1. myGUI::myGUI(QWidget *parent, Qt::WFlags flags)
    2. :QMainWindow(parent, flags),
    3. m_UiIsReadyToQuit(false)
    4. {
    5. ui.setupUi(this);
    6. mProgressBarDialog = NULL;
    7. connect(&thread, SIGNAL(ShowPB()),myPBarDialog,SLOT(PBoutput()));
    8. }
    9.  
    10. void myGUI::Add_clicked()
    11. {
    12. if(myProBarDialog == NULL) {
    13. myProBarDialog = new proBarDialog(this);
    14. }
    15. myProBarDialog->show();
    16.  
    17. // call the thread here
    18. thread.render();
    19.  
    20. updateInstanceList();
    21.  
    22. // Stop the thread here
    23. if (mProgressBarDialog != NULL)
    24. {
    25. mProgressBarDialog->close();
    26. mProgressBarDialog = NULL;
    27. }
    28. thread.stop();
    29. }
    To copy to clipboard, switch view to plain text mode 

    Thread code is like this
    *****************
    Qt Code:
    1. void PBarThread::render()
    2. {
    3. start(HighestPriority);
    4. }
    5.  
    6.  
    7. void PBarThread::run()
    8. {
    9. emit ShowPB();
    10. }
    11.  
    12. and PBarDialog code is like this
    13. ******************
    14. pBarDialog::pBarDialog(QWidget *parent)
    15. : QDialog(parent)
    16. {
    17. ui.setupUi(this);
    18. ui.pBar->show();
    19.  
    20. }
    21.  
    22. void pBarDialog::PBoutput()
    23. {
    24. ui.pBar->show();
    25. }
    To copy to clipboard, switch view to plain text mode 

    In Debug mode I can see that the call goes to ui.pBar->show() (not in PBOutput function). I see a frozen progress dialog, although it is running in separate thread. Why do I see a frozen Progress dialog? Why the slot PBoutput is not called although debug shows that thread has emited ShowPB() signal.

    Help,
    Dove17
    Last edited by wysota; 8th April 2010 at 20:33. Reason: missing [code] tags

Similar Threads

  1. How to blur parent dialog when child dialog is displayed
    By abhilashajha in forum Qt Programming
    Replies: 4
    Last Post: 10th June 2009, 13:01
  2. Replies: 4
    Last Post: 11th March 2008, 11:44
  3. Draw on a Progress Bar
    By fruzzo in forum Qt Programming
    Replies: 1
    Last Post: 8th December 2007, 15:31
  4. Reg - Progress bar
    By suresh in forum Qt Programming
    Replies: 1
    Last Post: 12th December 2006, 15:11
  5. progress DIalog
    By mickey in forum Newbie
    Replies: 2
    Last Post: 26th July 2006, 14:30

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.