#include <KoProgressUpdater.h>
Public Member Functions | |
| KoProgressUpdater (KoProgressProxy *progressBar) | |
| Constructor. | |
| virtual | ~KoProgressUpdater () |
| destructor | |
| void | start (int range=100, const QString &text="%p%") |
| Start a new task. | |
| KoUpdater | startSubtask (int weight=1) |
| After calling start() you can create any number of Updaters, one for each subtask. | |
| void | cancel () |
| Cancelling the action will make each subtask be marked as 'interrupted' and set the total progress to 100%. | |
Protected Member Functions | |
| void | scheduleUpdate () |
Friends | |
| class | KoProgressUpdaterPrivate |
This class is able to update a progress bar with the total progress of a project that may be separated into different subtasks. Each subtask will use one KoUpdater which that subtask can then report progress to. Each KoUpdater.setProgress() call will automatically calculate the total progress over the whole tasks made and update the progress bar with the total progress so far.
This class is created specifically with threading in mind so that subtasks can report their progress from their personal subthread and the progress bar will be updated correctly and not more often then repaints can return.
Typical usage can be:
KoProgressUpdater *pu = new KoProgressUpdater(myProgressBar); pu->start(100); // create the subtasks KoUpdater smooth = pu->startSubtask(5); KoUpdater scale = pu->startSubtask(5); KoUpdater cleanup = pu->startSubtask(1);
| KoProgressUpdater::KoProgressUpdater | ( | KoProgressProxy * | progressBar | ) |
Constructor.
| progressBar | the progress bar to update. |
| void KoProgressUpdater::start | ( | int | range = 100, |
|
| const QString & | text = "%p%" | |||
| ) |
Start a new task.
This will invalidate any previously created subtasks and set the range of the progressBar as well as the text in the progressbar.
| range | the total range of progress bar makes. | |
| text | The text to show in the progressBar. |
KoProgressProxy::setFormat()
| KoUpdater KoProgressUpdater::startSubtask | ( | int | weight = 1 |
) |
After calling start() you can create any number of Updaters, one for each subtask.
| weight | use a weight to specify the weight this subtask has compared to the rest of the subtasks. |
1.4.7