SystemToast
#include <bb/system/SystemToast>
To link against this class, add the following line to your .pro file: LIBS += -lbbsystem
A message displayed to the user that does not usually require user interaction to be dismissed.
The toast will be dismissed after a predefined timeout period lapses. If the toast includes a button, then the timeout period is activated with the first user interaction, for example, user touching the screen. During this time, if a button is displayed, the user can select it.
Presentation properties are marked as such, and affect future requests. Any pending requests will use the values of the presentation properties at the time of the request.
BlackBerry 10.0.0
Properties Index
Public Functions Index
| SystemToast (QObject *parent=0) | |
| virtual | ~SystemToast () |
| QString | body () const |
| QUrl | icon () const |
| bb::system::SystemUiPosition::Type | position () const |
| SystemUiButton * | button () |
| bb::system::SystemUiModality::Type | modality () const |
| void | setBody (const QString &body) |
| void | setIcon (const QUrl &icon) |
| void | setPosition (bb::system::SystemUiPosition::Type newPosition) |
| void | setModality (bb::system::SystemUiModality::Type newModality) |
| Q_INVOKABLE void | resetBody () |
| Q_INVOKABLE void | resetIcon () |
| Q_INVOKABLE void | resetPosition () |
| Q_INVOKABLE void | resetButton () |
| Q_INVOKABLE void | resetModality () |
| bb::system::SystemUiResult::Type | result () const |
| bb::system::SystemUiError::Type | error () const |
| Q_INVOKABLE bb::system::SystemUiButton * | buttonSelection () const |
Public Slots Index
| void | show () |
| bb::system::SystemUiResult::Type | exec () |
| void | cancel () |
Signals Index
| void | finished (bb::system::SystemUiResult::Type value) |
| void | bodyChanged (const QString &value) |
| void | iconChanged (const QUrl &value) |
| void | positionChanged (bb::system::SystemUiPosition::Type value) |
| void | modalityChanged (bb::system::SystemUiModality::Type newModality) |
Properties
QString
Represents the main text of the toast.
This is a presentation property whose default value is a default-constructed QString.
BlackBerry 10.0.0
QUrl
Represents the path to an image file that can be included in the toast.
This is a presentation property whose default value is a default-constructed QUrl.
BlackBerry 10.0.0
bb::system::SystemUiPosition::Type
Represents the position of the toast on the display.
bb::system::SystemUiPosition for a list of possible values.
BlackBerry 10.0.0
bb::system::SystemUiModality::Type
Represents the modality of the toast.
bb::system::SystemUiModality for the list of valid values.
Toasts are non-modal. Modality refers to the scope of the toast.
BlackBerry 10.0.0
bb::system::SystemUiButton
Represents the button that can be included in the toast.
This is a presentation property whose default bb::system::SystemUiButton::label property is a default-constructed QString.
The button is always shown as enabled. This button is omitted if its bb::system::SystemUiButton::label property is a default-constructed QString.
BlackBerry 10.0.0
bb::system::SystemUiResult::Type
Represents the result of the last completed request.
result() - the result of the request
error() - the error that occurred during the request (if applicable)
buttonSelection() - the button selected (if applicable)
bb::system::SystemUiResult for the list of possible results.
BlackBerry 10.0.0
bb::system::SystemUiError::Type
Represents the last error encountered.
bb::system::SystemUiError for the list of possible errors.
BlackBerry 10.0.0
Public Functions
Constructs a new instance of a toast.
| Parameters | |
|---|---|
| parent |
If not 0, the supplied parent will be responsible for deleting this instance. |
BlackBerry 10.0.0
virtual
Destructor.
BlackBerry 10.0.0
QString
Retrieves the main text of the toast.
The text of the toast.
BlackBerry 10.0.0
QUrl
Retrieves the icon for the toast.
The local path to the icon for the toast.
BlackBerry 10.0.0
bb::system::SystemUiPosition::Type
Retrieves the position of the toast.
bb::system::SystemUiPosition for the list of valid positions.
The toast position.
BlackBerry 10.0.0
SystemUiButton *
Retrieves the toast's button.
The toast's button.
BlackBerry 10.0.0
bb::system::SystemUiModality::Type
Retrieves the toast's modality.
bb::system::SystemUiModality for the list of possible values.
The toast's modality.
BlackBerry 10.0.0
void
Sets the main text of the toast.
| Parameters | |
|---|---|
| body |
The new text of the toast. |
BlackBerry 10.0.0
void
Sets the icon for the toast.
| Parameters | |
|---|---|
| icon |
The new local path to the icon for the toast. |
BlackBerry 10.0.0
void
Sets the position of the toast.
| Parameters | |
|---|---|
| newPosition |
The new toast position. See bb::system::SystemUiPosition for the list of valid positions. |
BlackBerry 10.0.0
void
Sets the modality for the toast.
| Parameters | |
|---|---|
| newModality |
The new modality preference. See bb::system::SystemUiModality for the list of possible values. |
BlackBerry 10.0.0
Q_INVOKABLE void
Resets the main text of the toast to QString::null.
BlackBerry 10.0.0
Q_INVOKABLE void
Resets the icon URL for the toast to an empty, default-constructed QUrl.
BlackBerry 10.0.0
Q_INVOKABLE void
Resets the position of the toast to bb::system::SystemUiPosition::MiddleCenter.
BlackBerry 10.0.0
Q_INVOKABLE void
Resets the button for this toast to be a default button with no text.
A reset button will not be shown.
BlackBerry 10.0.0
Q_INVOKABLE void
Resets the modality of the toast to bb::system::SystemUiModality::Application.
BlackBerry 10.0.0
bb::system::SystemUiResult::Type
Retrieves the result of the last completed request.
bb::system::SystemUiResult for the list of possible results.
The result of the last completed request.
BlackBerry 10.0.0
bb::system::SystemUiError::Type
Retrieves the error that occurred during the request.
bb::system::SystemUiError for the list of possible errors.
The error that occurred.
BlackBerry 10.0.0
Q_INVOKABLE bb::system::SystemUiButton *
Returns the button that was selected when a button selection is made.
If no button has been selected, 0 will be returned. This can occur when the toast timeout expires.
This function will return the result of the button selection of show() and exec().
The return value will be reset when a new request is made.
The button selected by the user.
BlackBerry 10.0.0
Public Slots
void
Displays or updates the toast based on current property values.
The result of the request can be retrieved with the SystemToast::result property, or using the signal finished(). The button that was selected can be retrieved with the buttonSelection() method.
Control is returned to the caller immediately. For a blocking request, use exec().
BlackBerry 10.0.0
bb::system::SystemUiResult::Type
Displays or updates the toast based on current property values.
The result of the request can be retrieved using the SystemToast::result property, or using the signal finished(). The button that was selected can be retrieved with the buttonSelection() method.
Unlike show(), this function will block until a button selection is made or the toast times out.
Any connections to this slot must use a Qt::QueuedConnection, or the slot must be triggered using QTimer::singleShot(), and
QObject::deleteLater() must be used in place of delete when deleting the dialog object. If these conditions are not met, unexpected behavior may result.
The result of the request. See bb::system::SystemUiResult for the list of possible results.
BlackBerry 10.0.0
void
Cancels the toast if it is still displayed.
BlackBerry 10.0.0
Signals
void
Emitted when a request is completed.
| Parameters | |
|---|---|
| value |
The result of the request. See bb::system::SystemUiResult for the list of possible results. |
BlackBerry 10.0.0
void
Emitted when the body property is changed programmatically.
| Parameters | |
|---|---|
| value |
The new value of the body property. |
BlackBerry 10.0.0
void
Emitted when the icon property is changed programmatically.
| Parameters | |
|---|---|
| value |
The new value of the icon property. |
BlackBerry 10.0.0
void
Emitted when the position property is changed programmatically.
| Parameters | |
|---|---|
| value |
The new value of the position property. |
BlackBerry 10.0.0
void
Emitted when the modality property is changed programmatically.
| Parameters | |
|---|---|
| newModality |
The new value of the modality property. |
BlackBerry 10.0.0