]>
cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/pixmapviewer.h
2 * SPDX-FileCopyrightText: 2006 Peter Penz <peter.penz19@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
19 * @brief Widget which shows a pixmap centered inside the boundaries.
21 * When the pixmap is changed, a smooth transition is done from the old pixmap
24 class PixmapViewer
: public QWidget
31 /** No transition is done when the pixmap is changed. */
35 * The old pixmap is replaced by the new pixmap and the size is
36 * adjusted smoothly to the size of the new pixmap.
41 * If the old pixmap and the new pixmap have the same content, but
42 * a different size it is recommended to use Transition::SizeTransition
43 * instead of Transition::DefaultTransition. In this case it is assured
44 * that the larger pixmap is used for downscaling, which leads
45 * to an improved scaling output.
50 explicit PixmapViewer(QWidget
* parent
,
51 Transition transition
= DefaultTransition
);
53 ~PixmapViewer() override
;
54 void setPixmap(const QPixmap
& pixmap
);
55 QPixmap
pixmap() const;
58 * Sets the size hint to \a size and triggers a relayout
59 * of the parent widget. Per default no size hint is given.
61 void setSizeHint(const QSize
& size
);
62 QSize
sizeHint() const override
;
64 void setAnimatedImageFileName(const QString
& fileName
);
65 QString
animatedImageFileName() const;
67 void stopAnimatedImage();
70 * Checks if \a mimeType has a format supported by QMovie.
72 static bool isAnimatedMimeType(const QString
&mimeType
);
75 void paintEvent(QPaintEvent
* event
) override
;
78 void checkPendingPixmaps();
79 void updateAnimatedImageFrame();
84 QMovie
* m_animatedImage
;
85 QQueue
<QPixmap
> m_pendingPixmaps
;
86 QTimeLine m_animation
;
87 Transition m_transition
;
90 bool m_hasAnimatedImage
;
93 inline QPixmap
PixmapViewer::pixmap() const