digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::DNotificationPopup Class Reference

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

+ Inheritance diagram for Digikam::DNotificationPopup:

Public Types

enum  PopupStyle { Boxed , Balloon }
 Styles that a DNotificationPopup can have. More...
 

Public Slots

void setPopupStyle (int popupstyle)
 Sets the visual appearance of the popup.
 
void setTimeout (int delay)
 Sets the delay for the popup is removed automatically.
 
void setVisible (bool visible) override
 
void show (const QPoint &p)
 Shows the popup in the given point.
 

Signals

void clicked ()
 Emitted when the popup is clicked.
 
void clickedAt (const QPoint &pos)
 Emitted when the popup is clicked at a specific position.
 

Public Member Functions

 DNotificationPopup (QWidget *const parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
 Creates a popup for the specified widget.
 
 DNotificationPopup (WId parent)
 Creates a popup for the specified window.
 
 ~DNotificationPopup () override
 Cleans up.
 
QPoint anchor () const
 Returns the position to which this popup is anchored.
 
bool autoDelete () const
 Returns whether the popup will be deleted when it is hidden.
 
void setAnchor (const QPoint &anchor)
 Sets the anchor of this popup.
 
virtual void setAutoDelete (bool autoDelete)
 Sets whether the popup will be deleted when it is hidden.
 
virtual void setView (const QString &caption, const QString &text, const QPixmap &icon)
 Creates a standard view then calls setView(QWidget*) .
 
void setView (const QString &caption, const QString &text=QString())
 Creates a standard view then calls setView(QWidget*) .
 
void setView (QWidget *child)
 Sets the main view to be the specified widget (which must be a child of the popup).
 
QWidget * standardView (const QString &caption, const QString &text, const QPixmap &icon, QWidget *parent=nullptr)
 Returns a widget that is used as standard view if one of the setView() methods taking the QString arguments is used.
 
int timeout () const
 Returns the delay before the popup is removed automatically.
 
QWidget * view () const
 Returns the main view.
 

Static Public Member Functions

static DNotificationPopupmessage (const QString &caption, const QString &text, const QPixmap &icon, QSystemTrayIcon *parent, int timeout=-1)
 Convenience method that displays popup with the specified icon, caption and message beside the icon of the specified QSystemTrayIcon.
 
static DNotificationPopupmessage (const QString &caption, const QString &text, const QPixmap &icon, QWidget *parent, int timeout=-1, const QPoint &p=QPoint())
 Convenience method that displays popup with the specified icon, caption and message beside the icon of the specified widget.
 
static DNotificationPopupmessage (const QString &caption, const QString &text, const QPixmap &icon, WId parent, int timeout=-1, const QPoint &p=QPoint())
 Convenience method that displays popup with the specified icon, caption and message beside the icon of the specified window.
 
static DNotificationPopupmessage (const QString &caption, const QString &text, QSystemTrayIcon *parent)
 Convenience method that displays popup with the specified caption and message beside the icon of the specified QSystemTrayIcon.
 
static DNotificationPopupmessage (const QString &caption, const QString &text, QWidget *parent, const QPoint &p=QPoint())
 Convenience method that displays popup with the specified caption and message beside the icon of the specified widget.
 
static DNotificationPopupmessage (const QString &text, QSystemTrayIcon *parent)
 Convenience method that displays popup with the specified message beside the icon of the specified QSystemTrayIcon.
 
static DNotificationPopupmessage (const QString &text, QWidget *parent, const QPoint &p=QPoint())
 Convenience method that displays popup with the specified message beside the icon of the specified widget.
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, const QPixmap &icon, QSystemTrayIcon *parent, int timeout=-1)
 Convenience method that displays popup with the specified popup-style, icon, caption and message beside the icon of the specified QSystemTrayIcon.
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, const QPixmap &icon, QWidget *parent, int timeout=-1, const QPoint &p=QPoint())
 Convenience method that displays popup with the specified popup-style, icon, caption and message beside the icon of the specified widget.
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, const QPixmap &icon, WId parent, int timeout=-1, const QPoint &p=QPoint())
 Convenience method that displays popup with the specified popup-style, icon, caption and message beside the icon of the specified window.
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, QSystemTrayIcon *parent)
 Convenience method that displays popup with the specified popup-style, caption and message beside the icon of the specified QSystemTrayIcon.
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, QWidget *parent, const QPoint &p=QPoint())
 Convenience method that displays popup with the specified popup-style, caption and message beside the icon of the specified widget.
 
static DNotificationPopupmessage (int popupStyle, const QString &text, QSystemTrayIcon *parent)
 Convenience method that displays popup with the specified popup-style and message beside the icon of the specified QSystemTrayIcon.
 
static DNotificationPopupmessage (int popupStyle, const QString &text, QWidget *parent, const QPoint &p=QPoint())
 Convenience method that displays popup with the specified popup-style and message beside the icon of the specified widget.
 

Protected Member Functions

virtual QPoint defaultLocation () const
 Returns a default location for popups when a better placement cannot be found.
 
void hideEvent (QHideEvent *) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 
void moveNear (const QRect &target)
 Moves the popup to be adjacent to target.
 
void paintEvent (QPaintEvent *pe) override
 
virtual void positionSelf ()
 Positions the popup.
 

Properties

bool autoDelete
 
int timeout
 

Detailed Description

The simplest uses of DNotificationPopup are by using the various message() static methods. The position the popup appears at depends on the type of the parent window:

Member Enumeration Documentation

◆ PopupStyle

Enumerator
Boxed 

Information will appear in a framed box (default)

Balloon 

Information will appear in a comic-alike balloon.

Member Function Documentation

◆ autoDelete()

bool Digikam::DNotificationPopup::autoDelete ( ) const
See also
setAutoDelete

◆ defaultLocation()

QPoint Digikam::DNotificationPopup::defaultLocation ( ) const
protectedvirtual

The default implementation returns the top-left corner of the available work area of the desktop (ie: minus panels, etc).

◆ message() [1/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  caption,
const QString &  text,
const QPixmap &  icon,
QSystemTrayIcon *  parent,
int  timeout = -1 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [2/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  caption,
const QString &  text,
const QPixmap &  icon,
QWidget *  parent,
int  timeout = -1,
const QPoint &  p = QPoint() 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [3/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  caption,
const QString &  text,
const QPixmap &  icon,
WId  parent,
int  timeout = -1,
const QPoint &  p = QPoint() 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [4/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  caption,
const QString &  text,
QSystemTrayIcon *  parent 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [5/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  caption,
const QString &  text,
QWidget *  parent,
const QPoint &  p = QPoint() 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [6/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  text,
QSystemTrayIcon *  parent 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [7/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  text,
QWidget *  parent,
const QPoint &  p = QPoint() 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [8/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( int  popupStyle,
const QString &  caption,
const QString &  text,
const QPixmap &  icon,
QSystemTrayIcon *  parent,
int  timeout = -1 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [9/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( int  popupStyle,
const QString &  caption,
const QString &  text,
const QPixmap &  icon,
QWidget *  parent,
int  timeout = -1,
const QPoint &  p = QPoint() 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [10/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( int  popupStyle,
const QString &  caption,
const QString &  text,
const QPixmap &  icon,
WId  parent,
int  timeout = -1,
const QPoint &  p = QPoint() 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [11/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( int  popupStyle,
const QString &  caption,
const QString &  text,
QSystemTrayIcon *  parent 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [12/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( int  popupStyle,
const QString &  caption,
const QString &  text,
QWidget *  parent,
const QPoint &  p = QPoint() 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [13/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( int  popupStyle,
const QString &  text,
QSystemTrayIcon *  parent 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ message() [14/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( int  popupStyle,
const QString &  text,
QWidget *  parent,
const QPoint &  p = QPoint() 
)
static

Note that the returned object is destroyed when it is hidden.

See also
setAutoDelete

◆ moveNear()

void Digikam::DNotificationPopup::moveNear ( const QRect &  target)
protected

The popup will be placed adjacent to, but outside of, target, without going off the current desktop.

Reimplementations of positionSelf() can use this to actually position the popup.

◆ positionSelf()

void Digikam::DNotificationPopup::positionSelf ( )
protectedvirtual

The default implementation attempts to place it by the taskbar entry; failing that it places it by the window of the associated widget; failing that it places it at the location given by defaultLocation().

See also
moveNear()

◆ setAnchor()

void Digikam::DNotificationPopup::setAnchor ( const QPoint &  anchor)

The popup is placed near to the anchor.

◆ setAutoDelete()

void Digikam::DNotificationPopup::setAutoDelete ( bool  autoDelete)
virtual

The default is false (unless created by one of the static message() overloads).

◆ setPopupStyle

void Digikam::DNotificationPopup::setPopupStyle ( int  popupstyle)
slot
See also
PopupStyle

◆ setTimeout

void Digikam::DNotificationPopup::setTimeout ( int  delay)
slot

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

◆ standardView()

QWidget * Digikam::DNotificationPopup::standardView ( const QString &  caption,
const QString &  text,
const QPixmap &  icon,
QWidget *  parent = nullptr 
)

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
captionThe window caption (title) on the popup
textThe text for the popup
iconThe icon to use for the popup
parentThe parent widget used for the returned widget. If left 0, then "this", i.e. the passive popup object will be used.
Returns
a QWidget containing the given arguments, looking like the standard passivepopups. The returned widget contains a QVBoxLayout, which is accessible through layout().
See also
setView( QWidget * )
setView( const QString&, const QString& )
setView( const QString&, const QString&, const QPixmap& )