class KPassivePopup

A dialog-like popup that displays messages without interupting the user. More...

Definition#include <kpassivepopup.h>
InheritsQFrame (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Slots

Signals

Public Static Methods

Protected Methods


Detailed Description

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( "hi32-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, WFlags f=0 )

KPassivePopup

Creates a popup for the specified widget.

 KPassivePopup ( WId parent, const char *name=0, WFlags f=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 &caption, const QString &text = QString::null )

setView

Creates a standard view then calls setView(QWidget*) .

void  setView ( const QString &caption, const QString &text, const QPixmap &icon )

setView

[virtual]

Creates a standard view then calls setView(QWidget*) .

QVBox *  standardView ( const QString& caption, const QString& text, const QPixmap& icon, QWidget *parent = 0L )

standardView

Returns a widget that is used as standard view if one of the setView() methods taking the QString arguments is used. You can use the returned widget to customize the passivepopup while keeping the look similar to the "standard" passivepopups.

After customizing the widget, pass it to setView( QWidget* )

Parameters:
parentThe parent widget used for the returned QVBox. If left 0L, then "this", i.e. the passive popup object will be used.

Returns: a QVBox containing the given arguments, looking like the standard passivepopups.

See also: QWidget, QWidget, *, ), setView(, const, QString&, const, QString&, ), setView(, const, QString&, const, QString&, const, QPixmap&, )

QWidgetview ()

view

[const]

Returns the main view.

int  timeout ()

timeout

[const]

Returns the delay before the popup is removed automatically.

void  setAutoDelete ( bool autoDelete )

setAutoDelete

[virtual]

Enables / disables auto-deletion of this widget when the #timeout occurs. The default is false. If you use the class-methods message(), auto-delection is turned on by default.

bool  autoDelete ()

autoDelete

[const]

Returns: true if the widget auto-deletes itself when the #timeout occurs.

See also: setAutoDelete

KPassivePopupmessage ( 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. Note that the returned object is destroyed when it is hidden.

See also: setAutoDelete

KPassivePopupmessage ( const QString &caption, const QString &text, 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. Note that the returned object is destroyed when it is hidden.

See also: setAutoDelete

KPassivePopupmessage ( const QString &caption, const QString &text, const QPixmap &icon, QWidget *parent, const char *name=0, int timeout = -1 )

message

[static]

Convenience method that displays popup with the specified icon, caption and message beside the icon of the specified widget. Note that the returned object is destroyed when it is hidden.

See also: setAutoDelete

KPassivePopupmessage ( const QString &caption, const QString &text, const QPixmap &icon, WId parent, const char *name=0, int timeout = -1 )

message

[static]

Convenience method that displays popup with the specified icon, caption and message beside the icon of the specified window. Note that the returned object is destroyed when it is hidden.

See also: setAutoDelete

void  setTimeout ( int delay )

setTimeout

[slot]

Sets the delay for the popup is removed automatically. Setting the delay to 0 disables the #timeout, if you're doing this, you may want to connect the clicked() signal to the hide() slot. Setting the delay to -1 makes it use the default value.

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  hideEvent ( QHideEvent * )

hideEvent

[protected virtual]

Reimplemented to destroy the object when autoDelete() is enabled.

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.

QRect  defaultArea ()

defaultArea

[protected const]

If no relative window (e.g. taskbar button, system tray window) is available, use this rectangle (pass it to moveNear()). Basically KWinModule::workArea() with width and height set to 0 so that moveNear uses the upper-left position.

Returns: The QRect to be passed to moveNear() ifno other is available.