Results 1 to 1 of 1

Thread: Problem in QProgressBar update

  1. #1
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Unhappy Problem in QProgressBar update

    Hi,

    I have read the discussions mentioned in the forum regarding how to sync update the progress bar(or indefinite is also fine) in parallel in with application running in background. Even though I am not able to update the progress bar.

    I will brief what I have done,

    case 1:
    1) created QThread class.

    Qt Code:
    1. QObject::connect( this, SIGNAL(valueChanged(int)),
    2. m_pMainwindow, SLOT(showProgress(int)),
    3. Qt::QueuedConnection);
    To copy to clipboard, switch view to plain text mode 
    in m_pMainwindow am setting the value of qprogressbar. It is not updating parallely instead once the background work is done it starts to update.

    slot:
    Qt Code:
    1. showprogress(int value)
    2. {
    3. value = value + 10;
    4. if(value > 100)
    5. value = 0;
    6.  
    7. m_TaskProgressBar->setValue(value);
    8. }
    To copy to clipboard, switch view to plain text mode 
    case 2:

    Qt Code:
    1. QObject::connect( m_pProgressIndicator, SIGNAL(progressing()), this,
    2. SLOT(showProgress()), Qt:BlockingQueuedConnection);
    To copy to clipboard, switch view to plain text mode 
    m_pProgressIndicator is a thread class and progressing() is signal where indefinitely it keeps emitting and showprogress() updates the progress, but here also the update happens after the job gets completed.

    slot:
    Qt Code:
    1. showprogress()
    2. {
    3. int value = m_TaskProgressBar->value();
    4. value = value + 10;
    5. if(value > 100)
    6. value = 0;
    7.  
    8. m_TaskProgressBar->setValue(value);
    9. }
    To copy to clipboard, switch view to plain text mode 
    In both cases i am not able to update QProgressbar parallely. Can anyone please let me know ASAP as how can i do the required ?

    Thanks in advance.
    Last edited by nikhilqt; 10th March 2009 at 13:47.

Similar Threads

  1. Replies: 1
    Last Post: 26th December 2007, 10:58
  2. QSlider Update Problem
    By December in forum Qt Programming
    Replies: 4
    Last Post: 10th September 2006, 04:02
  3. View update problem
    By prakash in forum Qt Programming
    Replies: 6
    Last Post: 17th March 2006, 10:13
  4. hide/show screen update problem
    By SkripT in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2006, 17:49
  5. Problem with screen update...
    By mysearch05 in forum Qt Programming
    Replies: 2
    Last Post: 27th January 2006, 18:24

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.