# class KPassivePopup

###

Module | kdeui
Namespace |
Class | KPassivePopup
Inherits | QFrame

A dialog-like popup that displays messages without interrupting 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:

- Normal Windows: The popup is placed adjacent to the icon of the window.
- System Tray Windows: The popup is placed adjact to the system tray window itself.
- Skip Taskbar Windows: The popup is placed adjact to the window
itself if it is visible, and at the edge of the desktop otherwise.

You also have the option of calling show with a QPoint as a parameter that removes the automatic placing of KPassivePopup and shows it in the point you want.

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 );

This screenshot shows a popup with both a caption and a main text which is being displayed next to the toolbar icon of the window that triggered it:

For more control over the popup, you can use the setView(QWidget *) method to create a custom popup.

    KPassivePopup *pop = new KPassivePopup( parent );

    KVBox *vb = new KVBox( pop );
    (void) new QLabel( vb, "Isn't this great?" );

    KHBox *box = new KHBox( vb );
    (void) new QPushButton( "Yes", box );
    (void) new QPushButton( "No", box );

    pop->setView( vb );
    pop->show();

Author Richard Moore, rich@kde.org Author Sascha Cunz, sascha.cunz@tiscali.de

### enums

- PopupStyle { Boxed, Balloon, CustomStyle }

enum details

### methods

- KPassivePopup (parent, f)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 0
  f | Qt.WFlags | 0

  Creates a popup for the specified widget.

- KPassivePopup (parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | WId |

  Creates a popup for the specified window.

- KPassivePopup (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget | 0
  a1 | Qt.WFlags | 0

- KPassivePopup (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | WId |

- anchor ( )

  returns QPoint

  Returns the position to which this popup is anchored.

- autoDelete ( )

  returns bool

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

  See also setAutoDelete

- calculateNearbyPoint (target)

  returns QPoint

  Argument | Type | Default
  --- | --- | ---
  target | QRect |

  Calculates the position to place the popup near the specified rectangle.

- clicked ( )

  returns Nothing
  SIGNAL ("clicked ()")

  Emitted when the popup is clicked.

- clicked (pos)

  returns Nothing
  SIGNAL ("clicked (const QPoint&)")

  Argument | Type | Default
  --- | --- | ---
  pos | QPoint |

  Emitted when the popup is clicked.

- defaultArea ( )

  returns QRect

  If no relative window (eg taskbar button, system tray window) is available, use this rectangle (pass it to moveNear()). Basically KWindowSystem.workArea() with width and height set to 0 so that moveNear uses the upper-left position. Returns The QRect to be passed to moveNear() if no other is available.

- hideEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QHideEvent |

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

- message (text, parent)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  parent | QWidget |

  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

- message (text, parent)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  parent | QSystemTrayIcon |

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

  See also setAutoDelete

- message (caption, text, parent)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  text | QString |
  parent | QWidget |

  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

- message (caption, text, parent)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  text | QString |
  parent | QSystemTrayIcon |

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

  See also setAutoDelete

- message (caption, text, icon, parent, timeout)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  text | QString |
  icon | QPixmap |
  parent | QWidget |
  timeout | int | -1

  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

- message (caption, text, icon, parent, timeout)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  text | QString |
  icon | QPixmap |
  parent | QSystemTrayIcon |
  timeout | int | -1

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

  See also setAutoDelete

- message (caption, text, icon, parent, timeout)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  text | QString |
  icon | QPixmap |
  parent | WId |
  timeout | int | -1

  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

- message (popupStyle, text, parent)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  popupStyle | int |
  text | QString |
  parent | QWidget |

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

  See also setAutoDelete

- message (popupStyle, text, parent)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  popupStyle | int |
  text | QString |
  parent | QSystemTrayIcon |

  Convenience method that displays popup with the specified popup-style and message beside the icon of the specified QSystemTrayIcon. Note that the returned object is destroyed when it is hidden.

  See also setAutoDelete

- message (popupStyle, caption, text, parent)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  popupStyle | int |
  caption | QString |
  text | QString |
  parent | QSystemTrayIcon |

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

  See also setAutoDelete

- message (popupStyle, caption, text, parent)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  popupStyle | int |
  caption | QString |
  text | QString |
  parent | QWidget |

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

  See also setAutoDelete

- message (popupStyle, caption, text, icon, parent, timeout)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  popupStyle | int |
  caption | QString |
  text | QString |
  icon | QPixmap |
  parent | QWidget |
  timeout | int | -1

  Convenience method that displays popup with the specified popup-style, 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

- message (popupStyle, caption, text, icon, parent, timeout)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  popupStyle | int |
  caption | QString |
  text | QString |
  icon | QPixmap |
  parent | QSystemTrayIcon |
  timeout | int | -1

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

  See also setAutoDelete

- message (popupStyle, caption, text, icon, parent, timeout)

  returns KPassivePopup
  static

  Argument | Type | Default
  --- | --- | ---
  popupStyle | int |
  caption | QString |
  text | QString |
  icon | QPixmap |
  parent | WId |
  timeout | int | -1

  Convenience method that displays popup with the specified popup-style, 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

- mouseReleaseEvent (e)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  e | QMouseEvent |

  Reimplemented to detect mouse clicks.

- moveNear (target)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  target | QRect |

  Moves the popup to be adjacent to the icon of the specified rectangle.

- paintEvent (pe)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  pe | QPaintEvent |

  Overwrite to paint the border when PopupStyle == Balloon. Unused if PopupStyle == Boxed

- positionSelf ( )

  returns Nothing

  This method positions the popup.

- setAnchor (anchor)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  anchor | QPoint |

  Sets the anchor of this popup. The popup tries automatically to adjust itself somehow around the point.

- setAutoDelete (autoDelete)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  autoDelete | bool |

  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.

- setPopupStyle (popupstyle)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  popupstyle | int |

  Sets the visual appearance of the popup.

  See also PopupStyle

- setTimeout (delay)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  delay | int |

  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.

  See also timeout

- setView (child)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  child | QWidget |

  Sets the main view to be the specified widget (which must be a child of the popup).

- setView (caption, text)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  text | QString | QString()

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

- setView (caption, text, icon)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  text | QString |
  icon | QPixmap |

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

- setVisible (visible)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  visible | bool |

- show ( )

  returns Nothing

  Reimplemented to reposition the popup.

- show (p)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | QPoint |

  Shows the popup in the given point

- standardView (caption, text, icon, parent)

  returns KVBox

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  text | QString |
  icon | QPixmap |
  parent | QWidget | 0

  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* )

  caption - The window caption (title) on the popup

  text - The text for the popup

  icon - The icon to use for the popup

  parent - The parent widget used for the returned KVBox. If left 0, then "this", i.e. the passive popup object will be used.

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

  See also setView( QWidget * )

  See also setView( const QString&, const QString& )

  See also setView( const QString&, const QString&, const QPixmap& )

- timeout ( )

  returns int

  Returns the delay before the popup is removed automatically.

- updateMask ( )

  returns Nothing

  Updates the transparency mask. Unused if PopupStyle == Boxed

- view ( )

  returns QWidget

  Returns the main view.

### enums - detail

- PopupStyle { Boxed, Balloon, CustomStyle }

  Styles that a KPassivePopup can have.

  | Boxed | - | - |
  | Balloon | - | - |
  | CustomStyle | - 128 | - |