The QMaemo5InformationBox class provides Hildon Banners and Notes for informing the user. More...
#include <QMaemo5InformationBox>
Inherits QDialog.
This class was introduced in Qt 4.6.
QMaemo5InformationBox ( QWidget * parent = 0 ) | |
~QMaemo5InformationBox () | |
void | setTimeout ( int ms ) |
void | setWidget ( QWidget * widget ) |
int | timeout () const |
QWidget * | widget () const |
void | clicked () |
void | information ( QWidget * parent, const QString & message, int timeout = DefaultTimeout ) |
virtual void | mousePressEvent ( QMouseEvent * me ) |
virtual void | paintEvent ( QPaintEvent * pe ) |
virtual void | showEvent ( QShowEvent * se ) |
virtual void | timerEvent ( QTimerEvent * te ) |
The QMaemo5InformationBox class provides Hildon Banners and Notes for informing the user.
The Maemo 5 information box class is a Maemo 5 specific class that is used to display an arbitrary widget with or without a timeout to alert the user to a situation.
Information boxes that have a timeout will show as Hildon Banners, which will be hidden after the specified time. In the case where NoTimeout is specified for the timeout value, the information box will show up as a Hildon Note, which has to be acknowledged by the user with a tap anywhere on the screen.
Two APIs for using QMaemo5InformationBox are provided: a property-based API and a static function. Calling the static function is the simpler approach, but it is less flexible than using the property-based API, since the widget is hardcoded to a QLabel.
Using the static function API is recommended only if textual information is to be displayed.
To use the property-based API, construct an instance of QMaemo5InformationBox, create the information widget, set the desired timeout, and call exec() (or show() for simple Banners) to show the message.
The clicked() signal will be emitted if the user clicks on the QMaemo5InformationBox, regardless of whether the information is shown with or without a timeout.
Note that, using the static function for some plain text strings containing XML meta-characters, the auto-text rich text detection test may fail causing your plain text string to be interpreted incorrectly as rich text. In these rare cases, use Qt::convertFromPlainText() to convert your plain text string to a visually equivalent rich text string, or use the property-based API and set your custom QLabel with setWidget().
The DefaultTimeout (3 seconds) is the timeout recommended by the Hildon style guide. The maximum timeout is 10 seconds.
Please see the Maemo 5 Widget, UI-Style and Master-Layout guides for hints on when, where and how to best use this information box.
This property holds the timeout after which the informaton box should automatically be hidden.
Setting this value while the box is already visible will reset its timer.
The timeout value can be specified as an arbitrary millisecond value, although it is recommended to use the predefined values NoTimeout (for Hildon Notes) and DefaultTimeout (for style guide compliant Banners).
The default value of this property is DefaultTimeout (3 seconds). The maximum timeout is 10 seconds.
Access functions:
int | timeout () const |
void | setTimeout ( int ms ) |
Constructs an information box with no text, a default timeout (DefaultTimeout) and the given parent widget.
Destroys the information box.
This signal is emitted whenever the QMaemo5InformationBox is clicked.
Opens an information message box with the specified message and timeout.
If the timeout parameter equals NoTimeout, the information box will show as a Hildon Note and this function will block until the user clicks anywhere on the screen. Otherwise, the information box show as a Hildon Banner, which will be hidden after timeout milliseconds. The function will return to the caller immediately in this case.
If there is no timeout specified and parent is 0, the information box is an application modal dialog box. If parent is a widget, the information box is window modal relative to the parent.
Reimplemented from QWidget::mousePressEvent().
Reimplemented from QWidget::paintEvent().
Sets the central widget of the information box to widget.
QMaemo5InformationBox will take ownership of widget by reparenting it. Any previously set widget() will be destroyed.
See also widget().
Reimplemented from QWidget::showEvent().
Reimplemented from QObject::timerEvent().
Returns the central widget of the information box.
See also setWidget().