1 | /* |
2 | SPDX-FileCopyrightText: 2009 Sebastian Trueg <trueg@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.1-or-later |
5 | */ |
6 | |
7 | #ifndef _K_PIXMAPSEQUENCE_WIDGET_H_ |
8 | #define _K_PIXMAPSEQUENCE_WIDGET_H_ |
9 | |
10 | #include <QWidget> |
11 | #include <memory> |
12 | |
13 | #include <kwidgetsaddons_export.h> |
14 | |
15 | class KPixmapSequence; |
16 | |
17 | /** |
18 | * \class KPixmapSequenceWidget kpixmapsequencewidget.h KPixmapSequenceWidget |
19 | * |
20 | * \brief A simple widget showing a fixed size pixmap sequence. |
21 | * |
22 | * The KPixmapSequenceWidget uses the KPixmapSequenceOverlayPainter to show a |
23 | * sequence of pixmaps. It is intended as a simple wrapper around the |
24 | * KPixmapSequenceOverlayPainter in case a widget is more appropriate than |
25 | * an event filter. |
26 | * |
27 | * \author Sebastian Trueg <trueg@kde.org> |
28 | * |
29 | * \since 4.4 |
30 | */ |
31 | class KWIDGETSADDONS_EXPORT KPixmapSequenceWidget : public QWidget |
32 | { |
33 | Q_OBJECT |
34 | Q_PROPERTY(int interval READ interval WRITE setInterval) |
35 | |
36 | public: |
37 | /** |
38 | * Constructor |
39 | */ |
40 | explicit KPixmapSequenceWidget(QWidget *parent = nullptr); |
41 | KPixmapSequenceWidget(const KPixmapSequence &seq, QWidget *parent = nullptr); |
42 | |
43 | /** |
44 | * Destructor |
45 | */ |
46 | ~KPixmapSequenceWidget() override; |
47 | |
48 | /** |
49 | * The sequence used to draw the overlay. |
50 | * |
51 | * \sa setSequence |
52 | */ |
53 | KPixmapSequence sequence() const; |
54 | |
55 | /** |
56 | * The interval between frames. |
57 | * |
58 | * \sa setInterval, KPixmapSequenceOverlayPainter::interval |
59 | */ |
60 | int interval() const; |
61 | |
62 | /** |
63 | * \reimpl |
64 | */ |
65 | QSize sizeHint() const override; |
66 | |
67 | public Q_SLOTS: |
68 | /** |
69 | * Set the sequence to be used. By default the KDE busy sequence is used. |
70 | */ |
71 | void setSequence(const KPixmapSequence &seq); |
72 | |
73 | /** |
74 | * Set the interval between frames. The default is 200. |
75 | * \sa interval, KPixmapSequenceOverlayPainter::setInterval |
76 | */ |
77 | void setInterval(int msecs); |
78 | |
79 | private: |
80 | std::unique_ptr<class KPixmapSequenceWidgetPrivate> const d; |
81 | }; |
82 | |
83 | #endif |
84 | |