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);
QObject::connect( this, SIGNAL(valueChanged(int)),
m_pMainwindow, SLOT(showProgress(int)),
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:
showprogress(int value)
{
value = value + 10;
if(value > 100)
value = 0;
m_TaskProgressBar->setValue(value);
}
showprogress(int value)
{
value = value + 10;
if(value > 100)
value = 0;
m_TaskProgressBar->setValue(value);
}
To copy to clipboard, switch view to plain text mode
case 2:
QObject::connect( m_pProgressIndicator,
SIGNAL(progressing
()),
this,
SLOT(showProgress()), Qt:BlockingQueuedConnection);
QObject::connect( m_pProgressIndicator, SIGNAL(progressing()), this,
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:
showprogress()
{
int value = m_TaskProgressBar->value();
value = value + 10;
if(value > 100)
value = 0;
m_TaskProgressBar->setValue(value);
}
showprogress()
{
int value = m_TaskProgressBar->value();
value = value + 10;
if(value > 100)
value = 0;
m_TaskProgressBar->setValue(value);
}
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.
Bookmarks