#include <progressbar.h>
Public Member Functions | |
| ProgressBar (QProgressBar *pB) | |
| QProgressBar * | getProgressBar () |
| void | start () |
| void | finish () |
| void | setMaxStep (int maxStep) |
| void | update (int step) |
Private Attributes | |
| QProgressBar * | progressBar |
Progress observer adapter. Implementation of IProgressBar which delegates all operations to wrapped Qt progress bar. This has to be created and destroyed by user (this is because Qt memmory management).
Instance can be used in ProgressObserver IObserver implementation.
Example:
// Creates QProgressBar instance QProgressBar * qtProgressBar=new QProgressBar();
// Creates adapter ProgressBar * progressBar=new ProgressBar(qtProgressBar);
// Creates and registers observer to process which progress we // want to display shared_ptr<ProgressObserver> progressObserver(new ProgressObserver(progressBar)); process->registerObserver(progressObserver);
In single thread application we can reuse progressObserver on more processes and have one progress bar vizualizator for all of them. In multithread applications where such processes runs in different threads this may be problem because this class doesn't use any kind of synchronization.
| gui::ProgressBar::ProgressBar | ( | QProgressBar * | pB | ) | [inline] |
Initialization constructor.
| pB | Qt progress bar instance. |
| void gui::ProgressBar::finish | ( | ) | [virtual] |
Progress terminator. Hides qt progress bar.
Implements pdfobjects::utils::IProgressBar.
References progressBar.
| QProgressBar* gui::ProgressBar::getProgressBar | ( | ) | [inline] |
| void gui::ProgressBar::setMaxStep | ( | int | maxStep | ) | [virtual] |
Sets maximum step count.
| maxStep | Number of steps of the process. |
Implements pdfobjects::utils::IProgressBar.
References progressBar.
| void gui::ProgressBar::start | ( | ) | [virtual] |
Progress initiator. Shows qt progress bar and sets its state to 0.
Implements pdfobjects::utils::IProgressBar.
References progressBar, and update().
| void gui::ProgressBar::update | ( | int | step | ) | [virtual] |
Updates progress state.
| step | Number of current steps from process start. |
Implements pdfobjects::utils::IProgressBar.
References progressBar.
Referenced by start().
QProgressBar* gui::ProgressBar::progressBar [private] |
Displayer of progress. This instance is allocated and deallocated by instance user.
Referenced by finish(), getProgressBar(), setMaxStep(), start(), and update().