digiKam
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 }
 

Public Slots

void setPopupStyle (int popupstyle)
 
void setTimeout (int delay)
 
void setVisible (bool visible) override
 
void show (const QPoint &p)
 

Signals

void clicked ()
 
void clicked (const QPoint &pos)
 

Public Member Functions

QPoint anchor () const
 
bool autoDelete () const
 
 DNotificationPopup (QWidget *const parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
 
 DNotificationPopup (WId parent)
 
void setAnchor (const QPoint &anchor)
 
virtual void setAutoDelete (bool autoDelete)
 
virtual void setView (const QString &caption, const QString &text, const QPixmap &icon)
 
void setView (const QString &caption, const QString &text=QString())
 
void setView (QWidget *child)
 
QWidget * standardView (const QString &caption, const QString &text, const QPixmap &icon, QWidget *parent=nullptr)
 
int timeout () const
 
QWidget * view () const
 
 ~DNotificationPopup () override
 

Static Public Member Functions

static DNotificationPopupmessage (const QString &caption, const QString &text, const QPixmap &icon, QSystemTrayIcon *parent, int timeout=-1)
 
static DNotificationPopupmessage (const QString &caption, const QString &text, const QPixmap &icon, QWidget *parent, int timeout=-1, const QPoint &p=QPoint())
 
static DNotificationPopupmessage (const QString &caption, const QString &text, const QPixmap &icon, WId parent, int timeout=-1, const QPoint &p=QPoint())
 
static DNotificationPopupmessage (const QString &caption, const QString &text, QSystemTrayIcon *parent)
 
static DNotificationPopupmessage (const QString &caption, const QString &text, QWidget *parent, const QPoint &p=QPoint())
 
static DNotificationPopupmessage (const QString &text, QSystemTrayIcon *parent)
 
static DNotificationPopupmessage (const QString &text, QWidget *parent, const QPoint &p=QPoint())
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, const QPixmap &icon, QSystemTrayIcon *parent, int timeout=-1)
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, const QPixmap &icon, QWidget *parent, int timeout=-1, const QPoint &p=QPoint())
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, const QPixmap &icon, WId parent, int timeout=-1, const QPoint &p=QPoint())
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, QSystemTrayIcon *parent)
 
static DNotificationPopupmessage (int popupStyle, const QString &caption, const QString &text, QWidget *parent, const QPoint &p=QPoint())
 
static DNotificationPopupmessage (int popupStyle, const QString &text, QSystemTrayIcon *parent)
 
static DNotificationPopupmessage (int popupStyle, const QString &text, QWidget *parent, const QPoint &p=QPoint())
 

Protected Member Functions

virtual QPoint defaultLocation () const
 
void hideEvent (QHideEvent *) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 
void moveNear (const QRect &target)
 
void paintEvent (QPaintEvent *pe) override
 
virtual void positionSelf ()
 

Properties

bool autoDelete
 
int timeout
 

Detailed Description

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

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

Styles that a DNotificationPopup can have.

Enumerator
Boxed 

Information will appear in a framed box (default)

Balloon 

Information will appear in a comic-alike balloon.

Constructor & Destructor Documentation

◆ DNotificationPopup() [1/2]

Digikam::DNotificationPopup::DNotificationPopup ( QWidget *const  parent = nullptr,
Qt::WindowFlags  f = Qt::WindowFlags() 
)
explicit

Creates a popup for the specified widget.

Referenced by message().

◆ DNotificationPopup() [2/2]

Digikam::DNotificationPopup::DNotificationPopup ( WId  parent)
explicit

Creates a popup for the specified window.

◆ ~DNotificationPopup()

Digikam::DNotificationPopup::~DNotificationPopup ( )
override

Cleans up.

Member Function Documentation

◆ anchor()

QPoint Digikam::DNotificationPopup::anchor ( ) const

Returns the position to which this popup is anchored.

Referenced by setAnchor().

◆ autoDelete()

bool Digikam::DNotificationPopup::autoDelete ( ) const

Returns whether the popup will be deleted when it is hidden.

See also
setAutoDelete

◆ clicked [1/2]

void Digikam::DNotificationPopup::clicked ( )
signal

Emitted when the popup is clicked.

Referenced by mouseReleaseEvent().

◆ clicked [2/2]

void Digikam::DNotificationPopup::clicked ( const QPoint &  pos)
signal

Emitted when the popup is clicked.

◆ defaultLocation()

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

Returns a default location for popups when a better placement cannot be found.

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

Referenced by positionSelf().

◆ hideEvent()

void Digikam::DNotificationPopup::hideEvent ( QHideEvent *  )
overrideprotected

@reimp

◆ message() [1/14]

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

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

References message(), and timeout.

◆ 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

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

References message(), and timeout.

◆ 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

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

References message(), and timeout.

◆ message() [4/14]

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

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

References message().

◆ message() [5/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  caption,
const QString &  text,
QWidget *  parent,
const QPoint &  p = QPoint() 
)
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

References message().

◆ message() [6/14]

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

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

References message().

◆ message() [7/14]

DNotificationPopup * Digikam::DNotificationPopup::message ( const QString &  text,
QWidget *  parent,
const QPoint &  p = QPoint() 
)
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

Referenced by message(), and Digikam::EditorWindow::slotLoadingFinished().

◆ message() [8/14]

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

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

References DNotificationPopup(), moveNear(), setAutoDelete(), setPopupStyle(), setView(), show(), and timeout.

◆ 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

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

References DNotificationPopup(), setAutoDelete(), setPopupStyle(), setView(), show(), and timeout.

◆ 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

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

References DNotificationPopup(), setAutoDelete(), setPopupStyle(), setView(), show(), and timeout.

◆ message() [11/14]

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

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

References message().

◆ message() [12/14]

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

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

References message().

◆ message() [13/14]

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

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

References message().

◆ message() [14/14]

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

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

References message().

◆ mouseReleaseEvent()

void Digikam::DNotificationPopup::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

@reimp

References clicked().

◆ moveNear()

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

Moves the popup to be adjacent to target.

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.

References Balloon, and setAnchor().

Referenced by message(), and positionSelf().

◆ paintEvent()

void Digikam::DNotificationPopup::paintEvent ( QPaintEvent *  pe)
overrideprotected

@reimp

References Balloon.

◆ positionSelf()

void Digikam::DNotificationPopup::positionSelf ( )
protectedvirtual

Positions the popup.

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

References defaultLocation(), and moveNear().

Referenced by setVisible().

◆ setAnchor()

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

Sets the anchor of this popup.

The popup is placed near to the anchor.

References anchor().

Referenced by moveNear(), and setVisible().

◆ setAutoDelete()

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

Sets whether the popup will be deleted when it is hidden.

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

References autoDelete.

Referenced by message().

◆ setPopupStyle

void Digikam::DNotificationPopup::setPopupStyle ( int  popupstyle)
slot

Sets the visual appearance of the popup.

See also
PopupStyle

References Balloon, and Boxed.

Referenced by message().

◆ setTimeout

void Digikam::DNotificationPopup::setTimeout ( int  delay)
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.

See also
timeout

◆ setView() [1/3]

void Digikam::DNotificationPopup::setView ( const QString &  caption,
const QString &  text,
const QPixmap &  icon 
)
virtual

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

References setView(), and standardView().

◆ setView() [2/3]

void Digikam::DNotificationPopup::setView ( const QString &  caption,
const QString &  text = QString() 
)

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

References setView().

◆ setView() [3/3]

void Digikam::DNotificationPopup::setView ( QWidget *  child)

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

References Balloon.

Referenced by message(), and setView().

◆ setVisible

void Digikam::DNotificationPopup::setVisible ( bool  visible)
overrideslot

@reimp

References Balloon, positionSelf(), and setAnchor().

◆ show

void Digikam::DNotificationPopup::show ( const QPoint &  p)
slot

Shows the popup in the given point

Referenced by message().

◆ standardView()

QWidget * Digikam::DNotificationPopup::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. 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& )

Referenced by setView().

◆ timeout()

int Digikam::DNotificationPopup::timeout ( ) const

Returns the delay before the popup is removed automatically.

◆ view()

QWidget * Digikam::DNotificationPopup::view ( ) const

Returns the main view.

Property Documentation

◆ autoDelete

bool Digikam::DNotificationPopup::autoDelete
readwrite

Referenced by setAutoDelete().

◆ timeout

int Digikam::DNotificationPopup::timeout
readwrite

Referenced by message().


The documentation for this class was generated from the following files: