]>
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
30 /** No transition is done when the pixmap is changed. */
34 * The old pixmap is replaced by the new pixmap and the size is
35 * adjusted smoothly to the size of the new pixmap.
40 * If the old pixmap and the new pixmap have the same content, but
41 * a different size it is recommended to use Transition::SizeTransition
42 * instead of Transition::DefaultTransition. In this case it is assured
43 * that the larger pixmap is used for downscaling, which leads
44 * to an improved scaling output.
49 explicit PixmapViewer(QWidget
*parent
, Transition transition
= DefaultTransition
);
51 ~PixmapViewer() override
;
52 void setPixmap(const QPixmap
&pixmap
);
53 QPixmap
pixmap() const;
56 * Sets the size hint to \a size and triggers a relayout
57 * of the parent widget. Per default no size hint is given.
59 void setSizeHint(const QSize
&size
);
60 QSize
sizeHint() const override
;
62 void setAnimatedImageFileName(const QString
&fileName
);
63 QString
animatedImageFileName() const;
65 void stopAnimatedImage();
68 * Checks if \a mimeType has a format supported by QMovie.
70 static bool isAnimatedMimeType(const QString
&mimeType
);
73 void paintEvent(QPaintEvent
*event
) override
;
76 void checkPendingPixmaps();
77 void updateAnimatedImageFrame();
82 QMovie
*m_animatedImage
;
83 QQueue
<QPixmap
> m_pendingPixmaps
;
84 QTimeLine m_animation
;
85 Transition m_transition
;
88 bool m_hasAnimatedImage
;
91 inline QPixmap
PixmapViewer::pixmap() const