KWidgetsAddons

kpixmapsequencewidget.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Sebastian Trueg <trueg@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#include "kpixmapsequencewidget.h"
8#include "kpixmapsequence.h"
9#include "kpixmapsequenceoverlaypainter.h"
10
11class KPixmapSequenceWidgetPrivate
12{
13public:
14 KPixmapSequenceOverlayPainter *m_painter = nullptr;
15};
16
18 : QWidget(parent)
19 , d(new KPixmapSequenceWidgetPrivate)
20{
21 d->m_painter = new KPixmapSequenceOverlayPainter(this);
22 d->m_painter->setWidget(this);
23}
24
26 : QWidget(parent)
27 , d(new KPixmapSequenceWidgetPrivate)
28{
29 d->m_painter = new KPixmapSequenceOverlayPainter(seq);
30 d->m_painter->setWidget(this);
31 if (seq.isValid()) {
32 d->m_painter->start();
33 }
34}
35
37{
38 delete d->m_painter;
39}
40
42{
43 return d->m_painter->sequence();
44}
45
46int KPixmapSequenceWidget::interval() const
47{
48 return d->m_painter->interval();
49}
50
52{
53 if (d->m_painter->sequence().isValid()) {
54 return d->m_painter->sequence().frameSize();
55 } else {
56 return QWidget::sizeHint();
57 }
58}
59
61{
62 d->m_painter->setSequence(seq);
63 if (seq.isValid()) {
65 d->m_painter->start();
66 } else {
67 d->m_painter->stop();
68 }
69}
70
72{
73 d->m_painter->setInterval(msecs);
74}
75
76#include "moc_kpixmapsequencewidget.cpp"
Paints a KPixmapSequence on top of any widget at any position.
void setSequence(const KPixmapSequence &seq)
Set the sequence to be used.
QSize sizeHint() const override
\reimpl
~KPixmapSequenceWidget() override
Destructor.
void setInterval(int msecs)
Set the interval between frames.
KPixmapSequenceWidget(QWidget *parent=nullptr)
Constructor.
KPixmapSequence sequence() const
The sequence used to draw the overlay.
Loads and gives access to the frames of a typical multi-row pixmap as often used for spinners.
QSize frameSize() const
bool isValid() const
void setFixedSize(const QSize &s)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.