A Helper class to control a generic progress dialog. More...
#include <message.h>
Public Slots | |
void | close () |
Closes the dialog asynchronously. More... | |
void | updateLabel (const QString &text) |
Updates the descriptive text displayed in the progress dialog. More... | |
void | setAutoDelete (bool autoDelete) |
WRITE accessor for ProgressControl::autoDelete. | |
void | setIndeterminate (bool indeterminate) |
WRITE accessor for ProgressControl::indeterminate. | |
void | setMinimum (int minimum) |
WRITE accessor for ProgressControl::minimum. | |
void | setMaximum (int maximum) |
WRITE accessor for ProgressControl::maximum. | |
void | setProgress (int progress) |
WRITE accessor for ProgressControl::progress. | |
void | setProgress (double progressPercent) |
WRITE accessor for ProgressControl::progressPercent. | |
Signals | |
void | autoDeleteChanged (bool autoDelete, QPrivateSignal) |
NOTIFY accessor for ProgressControl::autoDelete. | |
void | indeterminateChanged (bool indeterminate, QPrivateSignal) |
NOTIFY accessor for ProgressControl::indeterminate. | |
void | minimumChanged (int minimum, QPrivateSignal) |
NOTIFY accessor for ProgressControl::minimum. | |
void | maximumChanged (int maximum, QPrivateSignal) |
NOTIFY accessor for ProgressControl::maximum. | |
void | progressChanged (int progress, QPrivateSignal) |
NOTIFY accessor for ProgressControl::progress. | |
void | canceled (QtMvvm::MessageConfig::StandardButton btn, QPrivateSignal) |
Is emitted when the user canceled the dialog. More... | |
void | closed (QPrivateSignal) |
Is emitted after the dialog gui has been closed. More... | |
Presenter-Only signals | |
The following signals should be used by the presenter only, not from the core | |
void | changeLabel (const QString &text, QPrivateSignal) |
Is emitted when the descriptive text in the dialog should be updated. More... | |
void | closeRequested (QPrivateSignal) |
Is emitted when a closed was requested from the core code. More... | |
Public Member Functions | |
ProgressControl (QObject *parent=nullptr) | |
Constructor. | |
bool | autoDelete () const |
READ accessor for ProgressControl::autoDelete. | |
bool | isIndeterminate () const |
READ accessor for ProgressControl::indeterminate. | |
int | minimum () const |
READ accessor for ProgressControl::minimum. | |
int | maximum () const |
READ accessor for ProgressControl::maximum. | |
int | progress () const |
READ accessor for ProgressControl::progress. | |
Presenter-Only methods | |
The following methods should be used by the presenter only, not from the core | |
Q_INVOKABLE void | requestCancel (QtMvvm::MessageConfig::StandardButton btn) |
Signals the core app that the user tried to cancel the progress. More... | |
Q_INVOKABLE void | notifyClosed () |
Signals the core app that the dialog was closed. More... | |
Public Member Functions inherited from QObject | |
virtual const QMetaObject * | metaObject () const const |
virtual void * | qt_metacast (const char *) |
virtual int | qt_metacall (QMetaObject::Call, int, void **) |
QObject (QObject *parent) | |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
QString | objectName () const const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
bool | signalsBlocked () const const |
bool | blockSignals (bool block) |
QThread * | thread () const const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
const QObjectList & | children () const const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
void | dumpObjectTree () const const |
void | dumpObjectInfo () const const |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const const |
QList< QByteArray > | dynamicPropertyNames () const const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
bool | inherits (const char *className) const const |
void | deleteLater () |
Properties | |
bool | autoDelete |
Specifies whether the object should delete itself after completition. More... | |
bool | indeterminate |
Specifies whether the dialog should show an indeterminate or a normal progress. More... | |
int | minimum |
The minimum value of the progress bar. More... | |
int | maximum |
The maximum value of the progress bar. More... | |
int | progress |
The current value of the progress bar. More... | |
Properties inherited from QObject | |
objectName | |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
Protected Member Functions inherited from QObject | |
QObject * | sender () const const |
int | senderSignalIndex () const const |
int | receivers (const char *signal) const const |
bool | isSignalConnected (const QMetaMethod &signal) const const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
A Helper class to control a generic progress dialog.
This class is used together with dialogs of the MessageConfig::TypeProgressDialog type to control the currently displayed progress from the core code. The class is semi thread safe, as it is designed to be used from the core an the gui in parallel.
From the core code, i.e. wherever you created the progress instance (directly or indirectly), you can access:
From the GUI, if you intend to create your own presenter frontend, you can use:
|
signal |
Is emitted when the user canceled the dialog.
btn | The button that was pressed by the user |
Cancelling in this case means the user pressed the cancel button (MessageConfig::Cancel) or tried to close the dialog (MessageConfig::NoButton). In both cases, the dialog stays visible*! Your core code must react to the request by connecting this signal and ideally gracefully cancel the operation and then close() the dialog.
You can ignore the signal in case you showed a non cancelable dialog.
|
signal |
Is emitted when the descriptive text in the dialog should be updated.
text | The new label text |
You should use this text and replace the default descriptive text set by MessageConfig::text
|
slot |
Closes the dialog asynchronously.
You must use this method from the core code to close the dialog, either after successfully completing your long running operation, or as the result of a canceled operation, in case the user did cancel.
|
signal |
Is emitted after the dialog gui has been closed.
|
signal |
Is emitted when a closed was requested from the core code.
When the close() method is called from the core app, this signal eventually gets emitted. You must close the dialog immediatly and report that via the notifyClosed() method.
QtMvvm::ProgressControl::notifyClosed | ( | ) |
Signals the core app that the dialog was closed.
You must call this method as soon as you received a closeRequested() and have actually closed the dialog. You must call both, this method and MessageResult::complete.
QtMvvm::ProgressControl::requestCancel | ( | QtMvvm::MessageConfig::StandardButton | btn | ) |
Signals the core app that the user tried to cancel the progress.
btn | The button that was pressed by the user |
Call this method when the user either presses the cancel button (then pass MessageConfig::Cancel) or tried to close the window (pass MessageConfig::NoButton). Your GUI implementation should react to that with disabling the cancel button, but still show the progress, as the core app is to decide whether to accept that cancel request and if yes will eventually close the dialog. Internally, this method will emit canceled() in a thread-safe manner.
|
slot |
Updates the descriptive text displayed in the progress dialog.
The label text refers to the text initially set via MessageConfig::text. With this method, you can easily update this text as your operation commences.
|
readwrite |
Specifies whether the object should delete itself after completition.
Default: true
If set to true, the progress control will delete itself automatically right after closed() has been emitted.
Accessors | |
---|---|
READ | autoDelete() |
WRITE | setAutoDelete() |
NOTIFY | autoDeleteChanged() |
|
readwrite |
Specifies whether the dialog should show an indeterminate or a normal progress.
Default: false
If set to true, the dialog will ignore the minimum, maximum and progress properties and simply show an indeterminate progress. Setting it back to false restores a normal progress bar using these 3.
Accessors | |
---|---|
READ | isIndeterminate() |
WRITE | setIndeterminate() |
NOTIFY | indeterminateChanged() |
|
readwrite |
The maximum value of the progress bar.
Default: 100
The progress percentage (as number in [0,1]) is calculated as (progress - minimum)/(maximum - minimum)
and that value is used to display a progress. Chaning this property affects the result accordingly.
Accessors | |
---|---|
READ | maximum() |
WRITE | setMaximum() |
NOTIFY | maximumChanged() |
|
readwrite |
The minimum value of the progress bar.
Default: 0
The progress percentage (as number in [0,1]) is calculated as (progress - minimum)/(maximum - minimum)
and that value is used to display a progress. Chaning this property affects the result accordingly.
Accessors | |
---|---|
READ | minimum() |
WRITE | setMinimum() |
NOTIFY | minimumChanged() |
|
readwrite |
The current value of the progress bar.
Default: -1
The progress percentage (as number in [0,1]) is calculated as (progress - minimum)/(maximum - minimum)
and that value is used to display a progress. Chaning this property affects the result accordingly.
Setting it to -1
is a "special value", that means no progress has been set yet, and may or may not lead to a different presentation of that state from the simple minimum.
Accessors | |
---|---|
READ | progress() |
WRITE | setProgress() |
NOTIFY | progressChanged() |