PDA

View Full Version : Problem in QProgressBar update



nikhilqt
10th March 2009, 10:20
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.


QObject::connect( this, SIGNAL(valueChanged(int)),
m_pMainwindow, SLOT(showProgress(int)),
Qt::QueuedConnection);

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:

showprogress(int value)
{
value = value + 10;
if(value > 100)
value = 0;

m_TaskProgressBar->setValue(value);
}

case 2:


QObject::connect( m_pProgressIndicator, SIGNAL(progressing()), this,
SLOT(showProgress()), Qt:BlockingQueuedConnection);

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:

showprogress()
{
int value = m_TaskProgressBar->value();
value = value + 10;
if(value > 100)
value = 0;

m_TaskProgressBar->setValue(value);
}

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.