digiKam
Digikam::DNotificationWidget Class Reference
+ Inheritance diagram for Digikam::DNotificationWidget:

Classes

class  Private
 

Public Types

enum  MessageType { Positive , Information , Warning , Error }
 

Public Slots

void animatedHide ()
 
void animatedShow ()
 
void setCloseButtonVisible (bool visible)
 
void setIcon (const QIcon &icon)
 
void setMessageType (DNotificationWidget::MessageType type)
 
void setText (const QString &text)
 
void setWordWrap (bool wordWrap)
 

Signals

void hideAnimationFinished ()
 
void linkActivated (const QString &contents)
 
void linkHovered (const QString &contents)
 
void showAnimationFinished ()
 

Public Member Functions

void addAction (QAction *action)
 
void animatedShowTemporized (int delay)
 
void clearAllActions ()
 
 DNotificationWidget (const QString &text, QWidget *const parent=nullptr)
 
 DNotificationWidget (QWidget *const parent=nullptr)
 
int heightForWidth (int width) const override
 
QIcon icon () const
 
bool isCloseButtonVisible () const
 
bool isHideAnimationRunning () const
 
bool isShowAnimationRunning () const
 
MessageType messageType () const
 
QSize minimumSizeHint () const override
 
void removeAction (QAction *action)
 
QSize sizeHint () const override
 
QString text () const
 
bool wordWrap () const
 
 ~DNotificationWidget () override
 

Protected Member Functions

bool event (QEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 

Properties

bool closeButtonVisible
 
QIcon icon
 
MessageType messageType
 
QString text
 
bool wordWrap
 

Friends

class Private
 

Detailed Description

This widget can be used to provide inline positive or negative feedback, or to implement opportunistic interactions.

Member Enumeration Documentation

◆ MessageType

Available message types. The background colors are chosen depending on the message type.

Enumerator
Positive 
Information 
Warning 
Error 

Constructor & Destructor Documentation

◆ DNotificationWidget() [1/2]

Digikam::DNotificationWidget::DNotificationWidget ( QWidget *const  parent = nullptr)
explicit

◆ DNotificationWidget() [2/2]

Digikam::DNotificationWidget::DNotificationWidget ( const QString &  text,
QWidget *const  parent = nullptr 
)
explicit

◆ ~DNotificationWidget()

Digikam::DNotificationWidget::~DNotificationWidget ( )
override

Destructor.

Member Function Documentation

◆ addAction()

void Digikam::DNotificationWidget::addAction ( QAction *  action)

Add action to the message widget. For each action a button is added to the message widget in the order the actions were added.

Parameters
actionthe action to add
See also
removeAction(), QWidget::actions()

References Digikam::DNotificationWidget::Private::updateLayout().

◆ animatedHide

◆ animatedShow

◆ animatedShowTemporized()

void Digikam::DNotificationWidget::animatedShowTemporized ( int  delay)

Show the widget using an animation. The widget is automatically hidden after the delay (in ms).

References animatedShow(), Digikam::DNotificationWidget::Private::delay, setText(), Digikam::DNotificationWidget::Private::text, and Digikam::DNotificationWidget::Private::timer.

Referenced by Digikam::ItemIconView::slotNotificationError().

◆ clearAllActions()

void Digikam::DNotificationWidget::clearAllActions ( )

clear all actions from the message widget.

See also
DNotificationWidget::MessageType, addAction(), setMessageType()

◆ event()

bool Digikam::DNotificationWidget::event ( QEvent *  event)
overrideprotected

◆ heightForWidth()

int Digikam::DNotificationWidget::heightForWidth ( int  width) const
override

Returns the required height for width.

Parameters
widththe width in pixels

References Digikam::DNotificationWidget::Private::content.

◆ hideAnimationFinished

void Digikam::DNotificationWidget::hideAnimationFinished ( )
signal

This signal is emitted when the hide animation is finished, started by calling animatedHide(). If animations are disabled, this signal is emitted immediately after the message widget got hidden.

Note
This signal is not emitted if the widget was hidden by calling hide(), so this signal is only useful in conjunction with animatedHide().
See also
animatedHide()

Referenced by animatedHide().

◆ icon()

QIcon Digikam::DNotificationWidget::icon ( ) const

The icon shown on the left of the text. By default, no icon is shown.

References Digikam::DNotificationWidget::Private::icon.

◆ isCloseButtonVisible()

bool Digikam::DNotificationWidget::isCloseButtonVisible ( ) const

Check whether the close button is visible.

See also
setCloseButtonVisible()

References Digikam::DNotificationWidget::Private::closeButton.

◆ isHideAnimationRunning()

bool Digikam::DNotificationWidget::isHideAnimationRunning ( ) const

Check whether the hide animation started by calling animatedHide() is still running. If animations are disabled, this function always returns false.

See also
animatedHide(), hideAnimationFinished()

References Digikam::DNotificationWidget::Private::timeLine.

◆ isShowAnimationRunning()

bool Digikam::DNotificationWidget::isShowAnimationRunning ( ) const

Check whether the show animation started by calling animatedShow() is still running. If animations are disabled, this function always returns false.

See also
animatedShow(), showAnimationFinished()

References Digikam::DNotificationWidget::Private::timeLine.

◆ linkActivated

void Digikam::DNotificationWidget::linkActivated ( const QString &  contents)
signal

This signal is emitted when the user clicks a link in the text label. The URL referred to by the href anchor is passed in contents.

Parameters
contentstext of the href anchor
See also
QLabel::linkActivated()

Referenced by Digikam::DNotificationWidget::Private::init().

◆ linkHovered

void Digikam::DNotificationWidget::linkHovered ( const QString &  contents)
signal

This signal is emitted when the user hovers over a link in the text label. The URL referred to by the href anchor is passed in contents.

Parameters
contentstext of the href anchor
See also
QLabel::linkHovered()

Referenced by Digikam::DNotificationWidget::Private::init().

◆ messageType()

DNotificationWidget::MessageType Digikam::DNotificationWidget::messageType ( ) const

Get the type of this message. By default, the type is set to DNotificationWidget::Information.

See also
DNotificationWidget::MessageType, setMessageType()

References Digikam::DNotificationWidget::Private::messageType.

◆ minimumSizeHint()

QSize Digikam::DNotificationWidget::minimumSizeHint ( ) const
override

Returns the minimum size of the message widget.

References Digikam::DNotificationWidget::Private::content.

◆ paintEvent()

void Digikam::DNotificationWidget::paintEvent ( QPaintEvent *  event)
overrideprotected

◆ removeAction()

void Digikam::DNotificationWidget::removeAction ( QAction *  action)

Remove action from the message widget.

Parameters
actionthe action to remove
See also
DNotificationWidget::MessageType, addAction(), setMessageType()

References Digikam::DNotificationWidget::Private::updateLayout().

◆ resizeEvent()

void Digikam::DNotificationWidget::resizeEvent ( QResizeEvent *  event)
overrideprotected

◆ setCloseButtonVisible

void Digikam::DNotificationWidget::setCloseButtonVisible ( bool  visible)
slot

Set the visibility of the close button. If visible is true, a close button is shown that calls animatedHide() if clicked.

See also
closeButtonVisible(), animatedHide()

References Digikam::DNotificationWidget::Private::closeButton.

Referenced by Digikam::ItemIconView::ItemIconView().

◆ setIcon

void Digikam::DNotificationWidget::setIcon ( const QIcon &  icon)
slot

Define an icon to be shown on the left of the text

References icon, Digikam::DNotificationWidget::Private::icon, and Digikam::DNotificationWidget::Private::iconLabel.

◆ setMessageType

void Digikam::DNotificationWidget::setMessageType ( DNotificationWidget::MessageType  type)
slot

◆ setText

void Digikam::DNotificationWidget::setText ( const QString &  text)
slot

Set the text of the message widget to text. If the message widget is already visible, the text changes on the fly.

Parameters
textthe text to display, rich text is allowed
See also
text()

References Digikam::DNotificationWidget::Private::delay, text, Digikam::DNotificationWidget::Private::text, and Digikam::DNotificationWidget::Private::textLabel.

Referenced by animatedShowTemporized(), DNotificationWidget(), and Digikam::ItemIconView::slotNotificationError().

◆ setWordWrap

void Digikam::DNotificationWidget::setWordWrap ( bool  wordWrap)
slot

Set word wrap to wordWrap. If word wrap is enabled, the text() of the message widget is wrapped to fit the available width. If word wrap is disabled, the message widget's minimum size is such that the entire text fits.

Parameters
wordWrapdisable/enable word wrap
See also
wordWrap()

References Digikam::DNotificationWidget::Private::textLabel, Digikam::DNotificationWidget::Private::updateLayout(), wordWrap, and Digikam::DNotificationWidget::Private::wordWrap.

Referenced by Digikam::ItemIconView::ItemIconView().

◆ showAnimationFinished

void Digikam::DNotificationWidget::showAnimationFinished ( )
signal

This signal is emitted when the show animation is finished, started by calling animatedShow(). If animations are disabled, this signal is emitted immediately after the message widget got shown.

Note
This signal is not emitted if the widget was shown by calling show(), so this signal is only useful in conjunction with animatedShow().
See also
animatedShow()

Referenced by animatedShow().

◆ sizeHint()

QSize Digikam::DNotificationWidget::sizeHint ( ) const
override

Returns the preferred size of the message widget.

References Digikam::DNotificationWidget::Private::content.

◆ text()

QString Digikam::DNotificationWidget::text ( ) const

Get the text of this message widget.

See also
setText()

References Digikam::DNotificationWidget::Private::textLabel.

◆ wordWrap()

bool Digikam::DNotificationWidget::wordWrap ( ) const

Check whether word wrap is enabled.

If word wrap is enabled, the message widget wraps the displayed text as required to the available width of the widget. This is useful to avoid breaking widget layouts.

See also
setWordWrap()

References Digikam::DNotificationWidget::Private::wordWrap.

Friends And Related Function Documentation

◆ Private

friend class Private
friend

Property Documentation

◆ closeButtonVisible

bool Digikam::DNotificationWidget::closeButtonVisible
readwrite

◆ icon

QIcon Digikam::DNotificationWidget::icon
readwrite

Referenced by setIcon().

◆ messageType

MessageType Digikam::DNotificationWidget::messageType
readwrite

◆ text

QString Digikam::DNotificationWidget::text
readwrite

Referenced by DNotificationWidget(), and setText().

◆ wordWrap

bool Digikam::DNotificationWidget::wordWrap
readwrite

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