I'm developing an app which is mainly a file browser. I need to create a Progress Indication when deleting files to show the progress to the user.
I have created one, but it's ugly and not working as expected.
Below is the look of Progress
this is not really sexy... I would expect a kind of cancel icon and having a window with more space around the progress indicator and why not a text saying : 1/10, 2/10...
The second issue I had is that it seems that the progress bar is not working correctly. The progress do not show up.
Below is the code used. QProgressBar is a method in my DialogBox Class.
void MyDialog::ProgressIndicator(uint32_t max_value) {
//ProgressInd = new QProgressBar();
ProgressInd.setRange(0,max_value);
ProgressInd.setValue(0);
ProgressInd.show();
}
void MyDialog::ProgressUpdate(uint32_t value) {
ProgressInd.setValue(value);
}
void MyDialog::ProgressClose() {
ProgressInd.close();
}
ProgressInd is defined in the header file as followed:
QProgressBar ProgressInd;
I'm using the ProgresBar in my code a:
TreeBox->ProgressIndicator(item.count());
for (int i=0; i<item.count();i++) {
myItem = dynamic_cast<MyTreeWidgetItem*>(item[i]);
if((myItem->item_id == INVALID) || (myItem->id == INVALID)) {
/* Shouldn't happened as id must be filed at creation */
/* safety mechanism */
delete myItem;
}
else {
error = m_device.DeleteFile(myItem_id);
if(error == ERROR_NONE)
{
delete myItem;
}
else {
TreeBox->NotificationBox("File(s) deletion Failed");
TreeBox->ProgressClose();
return;
}
}
TreeBox->ProgressUpdate(i++);
}
TreeBox->ProgressClose();