|
|
A dialog-like popup that displays messages without interupting the user. The simplest uses of KPassivePopup are by using the various message() static methods. The position the popup appears at depends on the type of the parent window:
The most basic use of KPassivePopup displays a popup containing a piece of text:
KPassivePopup::message( "This is the message", this ); |
We can create popups with titles and icons too, as this example shows:
QPixmap px; px.load( "lo32-app-logtracker.png" ); KPassivePopup::message( "Some title", "This is the main text", px, this ); |
For more control over the popup, you can use the setView(QWidget *) method to create a custom popup.
KPassivePopup *pop = new KPassivePopup( parent ); QVBox *vb = new QVBox( pop ); (void) new QLabel( "<b>Isn't this great?</b>", vb ); QHBox *box = new QHBox( vb ); (void) new QPushButton( "Yes", box ); (void) new QPushButton( "No", box ); pop->setView( vb ); pop->show(); |
KPassivePopup ( QWidget *parent=0, const char *name=0 )
| KPassivePopup |
Creates a popup for the specified widget.
KPassivePopup ( WId parent, const char *name=0 )
| KPassivePopup |
Creates a popup for the specified window.
~KPassivePopup ()
| ~KPassivePopup |
[virtual]
Cleans up.
void setView ( QWidget *child )
| setView |
Sets the main view to be the specified widget (which must be a child of the popup).
void setView ( const QString &text, const QString &caption = QString::null )
| setView |
Creates a standard view then calls setView(QWidget*) .
void setView ( const QString &text, const QString &caption, const QPixmap &icon )
| setView |
[virtual]
Creates a standard view then calls setView(QWidget*) .
QWidget * view ()
| view |
[const]
Returns the main view
int timeout ()
| timeout |
[const]
Returns the delay before the popup is removed automatically.
KPassivePopup * message ( const QString &text, QWidget *parent, const char *name=0 )
| message |
[static]
Convenience method that displays popup with the specified message beside the icon of the specified widget.
KPassivePopup * message ( const QString &text, const QString &caption,
QWidget *parent, const char *name=0 )
| message |
[static]
Convenience method that displays popup with the specified caption and message beside the icon of the specified widget.
KPassivePopup * message ( const QString &text,
const QString &caption, const QPixmap &icon,
QWidget *parent, const char *name=0 )
| message |
[static]
Convenience method that displays popup with the specified icon, caption and message beside the icon of the specified widget.
void setTimeout ( int delay )
| setTimeout |
[slot]
Sets the delay for the popup is removed automatically. Setting the delay to -1 disables the timeout, if you're doing this, you may want to connect the clicked() signal to the hide() slot.
void show ()
| show |
[virtual slot]
Reimplemented to reposition the popup.
void clicked ()
| clicked |
[signal]
Emitted when the popup is clicked.
void clicked ( QPoint pos )
| clicked |
[signal]
Emitted when the popup is clicked.
void positionSelf ()
| positionSelf |
[protected virtual]
This method positions the popup.
void moveNear ( QRect target )
| moveNear |
[protected]
Moves the popup to be adjacent to the icon of the specified rectangle.
void mouseReleaseEvent ( QMouseEvent *e )
| mouseReleaseEvent |
[protected virtual]
Reimplemented to detect mouse clicks.