digiKam
Loading...
Searching...
No Matches
dnotificationwidget.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2011-07-03
7 * Description : A widget to provide feedback or propose opportunistic interactions
8 *
9 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2011 by Aurelien Gateau <agateau at kde dot org>
11 * SPDX-FileCopyrightText: 2014 by Dominik Haumann <dhaumann at kde dot org>
12 *
13 * SPDX-License-Identifier: GPL-2.0-or-later
14 *
15 * ============================================================ */
16
17#pragma once
18
19// Qt includes
20
21#include <QFrame>
22#include <QIcon>
23#include <QString>
24#include <QAction>
25
26// Local includes
27
28#include "digikam_export.h"
29
30namespace Digikam
31{
32
37class DIGIKAM_EXPORT DNotificationWidget : public QFrame
38{
39 Q_OBJECT
40 Q_PROPERTY(QString text READ text WRITE setText)
41 Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
42 Q_PROPERTY(bool closeButtonVisible READ isCloseButtonVisible WRITE setCloseButtonVisible)
43 Q_PROPERTY(MessageType messageType READ messageType WRITE setMessageType)
44 Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
45
46public:
47
60 Q_ENUM(MessageType)
61
62public:
63
67 explicit DNotificationWidget(QWidget* const parent = nullptr);
68
73 explicit DNotificationWidget(const QString& text, QWidget* const parent = nullptr);
74
78 ~DNotificationWidget() override;
79
84 QString text() const;
85
95 bool wordWrap() const;
96
102 bool isCloseButtonVisible() const;
103
110 MessageType messageType() const;
111
120 void addAction(QAction* action);
121
128 void removeAction(QAction* action);
129
135 void clearAllActions();
136
140 QSize sizeHint() const override;
141
145 QSize minimumSizeHint() const override;
146
151 int heightForWidth(int width) const override;
152
156 QIcon icon() const;
157
165 bool isHideAnimationRunning() const;
166
174 bool isShowAnimationRunning() const;
175
179 void animatedShowTemporized(int delay);
180
181public Q_SLOTS:
182
190 void setText(const QString& text);
191
201 void setWordWrap(bool wordWrap);
202
209 void setCloseButtonVisible(bool visible);
210
217 void setMessageType(DNotificationWidget::MessageType type);
218
222 void animatedShow();
223
227 void animatedHide();
228
232 void setIcon(const QIcon& icon);
233
234Q_SIGNALS:
235
242 void linkActivated(const QString& contents);
243
250 void linkHovered(const QString& contents);
251
264
277
278private Q_SLOTS:
279
280 void slotTimerTimeout();
281
282protected:
283
284 void paintEvent(QPaintEvent* event) override;
285 bool event(QEvent* event) override;
286 void resizeEvent(QResizeEvent* event) override;
287
288private:
289
290 class Private;
291 Private* const d = nullptr;
292
293 friend class Private;
294};
295
296} // namespace Digikam
Definition dnotificationwidget_p.h:37
Definition dnotificationwidget.h:38
void linkHovered(const QString &contents)
MessageType
Definition dnotificationwidget.h:53
@ Positive
Definition dnotificationwidget.h:54
@ Warning
Definition dnotificationwidget.h:57
@ Information
Definition dnotificationwidget.h:56
@ Notification
Definition dnotificationwidget.h:55
void linkActivated(const QString &contents)
Definition datefolderview.cpp:34