The ProgressBar doesnt close Properly
-
Tried to close the ProgressBar , by giving the condition , But it doesnt hide
void Timer::SetValueProgress()
{
// QMessageBox::information(this,"Progressbar");
popup_progress->setValue(popup_progress->value()+1);
int value = popup_progress->value() + 1;
popup_progress->setValue(value);
if ( value == 100 )
{
popup_progress->hide();
}
}
Is there is any Mistake in this Code -
@sankarapandiyan
I would say, that totally depends on how often you callsetValueProgress()
and what the initial value of the progress bar is.Hard to tell, but an obvious trip fall is
if ( value == 100 )
is your value 99 and you call setValueProgress, it becomes 101 and will never hide itself -
@sankarapandiyan said in The ProgressBar doesnt close Properly:
popup_progress->setValue(popup_progress->value()+1);
int value = popup_progress->value() + 1;
popup_progress->setValue(value);Why do you set the value twice?!
Lets say popup_progress->value() is 99, then:popup_progress->setValue(popup_progress->value()+1); // here you set it to 100 int value = popup_progress->value() + 1; // value is 101 now popup_progress->setValue(value); // you set 101 here
So, value is never 100 in my example!