digiKam Developer Documentation: Digikam::DNotificationWidget Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | Friends | List of all members
Digikam::DNotificationWidget Class Reference

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

Inheritance diagram for Digikam::DNotificationWidget:

## Public Types
enum | MessageType { Positive , Notification , Information , Warning , Error }
| Available message types. More...

## Public Slots
void | animatedHide ()
| Hide the widget using an animation.
void | animatedShow ()
| Show the widget using an animation.
void | setCloseButtonVisible (bool visible)
| Set the visibility of the close button.
void | setIcon (const QIcon &icon)
| Define an icon to be shown on the left of the text.
void | setMessageType (DNotificationWidget::MessageType type)
| Set the message type to `type`.
void | setText (const QString &text)
| Set the text of the message widget to `text`.
void | setWordWrap (bool wordWrap)
| Set word wrap to `wordWrap`.

## Signals
void | hideAnimationFinished ()
| This signal is emitted when the hide animation is finished, started by calling animatedHide().
void | linkActivated (const QString &contents)
| This signal is emitted when the user clicks a link in the text label.
void | linkHovered (const QString &contents)
| This signal is emitted when the user hovers over a link in the text label.
void | showAnimationFinished ()
| This signal is emitted when the show animation is finished, started by calling animatedShow().

## Public Member Functions
| DNotificationWidget (const QString &text, QWidget *const parent=nullptr)
| Constructs a DNotificationWidget with the specified `parent` and contents `text`.
| DNotificationWidget (QWidget *const parent=nullptr)
| Constructs a DNotificationWidget with the specified `parent`.
| ~DNotificationWidget () override
| Destructor.
void | addAction (QAction *action)
| Add `action` to the message widget.
void | animatedShowTemporized (int delay)
| Show the widget using an animation.
void | clearAllActions ()
| clear all actions from the message widget.
int | heightForWidth (int width) const override
| Returns the required height for `width`.
QIcon | icon () const
| The icon shown on the left of the text.
bool | isCloseButtonVisible () const
| Check whether the close button is visible.
bool | isHideAnimationRunning () const
| Check whether the hide animation started by calling animatedHide() is still running.
bool | isShowAnimationRunning () const
| Check whether the show animation started by calling animatedShow() is still running.
MessageType | messageType () const
| Get the type of this message.
QSize | minimumSizeHint () const override
| Returns the minimum size of the message widget.
void | removeAction (QAction *action)
| Remove `action` from the message widget.
QSize | sizeHint () const override
| Returns the preferred size of the message widget.
QString | text () const
| Get the text of this message widget.
bool | wordWrap () const
| Check whether word wrap is enabled.

## 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

## Member Enumeration Documentation

## ◆ MessageType

enum Digikam::DNotificationWidget::MessageType

The background colors are chosen depending on the message type.

## Member Function Documentation

## ◆ addAction()

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

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

Parameters

  action | the action to add

See also
  removeAction(), QWidget::actions()

## ◆ animatedShowTemporized()

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

The widget is automatically hidden after the delay (in ms).

## ◆ clearAllActions()

void Digikam::DNotificationWidget::clearAllActions | ( |  | ) |

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

## ◆ heightForWidth()

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

Parameters

  width | the width in pixels

## ◆ hideAnimationFinished

void Digikam::DNotificationWidget::hideAnimationFinished | ( |  | ) |
| signal

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

## ◆ icon()

QIcon Digikam::DNotificationWidget::icon | ( |  | ) | const

By default, no icon is shown.

## ◆ isCloseButtonVisible()

bool Digikam::DNotificationWidget::isCloseButtonVisible | ( |  | ) | const

See also
  setCloseButtonVisible()

## ◆ isHideAnimationRunning()

bool Digikam::DNotificationWidget::isHideAnimationRunning | ( |  | ) | const

If animations are disabled, this function always returns false.

See also
  animatedHide(), hideAnimationFinished()

## ◆ isShowAnimationRunning()

bool Digikam::DNotificationWidget::isShowAnimationRunning | ( |  | ) | const

If animations are disabled, this function always returns false.

See also
  animatedShow(), showAnimationFinished()

## ◆ linkActivated

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

The URL referred to by the href anchor is passed in contents.

Parameters

  contents | text of the href anchor

See also
  QLabel::linkActivated()

## ◆ linkHovered

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

The URL referred to by the href anchor is passed in contents.

Parameters

  contents | text of the href anchor

See also
  QLabel::linkHovered()

## ◆ messageType()

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

By default, the type is set to DNotificationWidget::Information.

See also
  DNotificationWidget::MessageType, setMessageType()

## ◆ removeAction()

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

Parameters

  action | the action to remove

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

## ◆ setCloseButtonVisible

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

If `visible` is true, a close button is shown that calls animatedHide() if clicked.

See also
  closeButtonVisible(), animatedHide()

## ◆ setMessageType

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

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

See also
  messageType(), DNotificationWidget::MessageType

## ◆ setText

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

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

Parameters

  text | the text to display, rich text is allowed

See also
  text()

## ◆ setWordWrap

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

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

  wordWrap | disable/enable word wrap

See also
  wordWrap()

## ◆ showAnimationFinished

void Digikam::DNotificationWidget::showAnimationFinished | ( |  | ) |
| signal

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

## ◆ text()

QString Digikam::DNotificationWidget::text | ( |  | ) | const

See also
  setText()

## ◆ wordWrap()

bool Digikam::DNotificationWidget::wordWrap | ( |  | ) | const

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