QQuickImageProvider for ForkAwesome 0.3.4
QQuickImageProvider for ForkAwesome
Loading...
Searching...
No Matches
imageprovider.h
Go to the documentation of this file.
1#ifndef QT_FORK_AWESOME_QUICK_IMAGE_PROVIDER
2#define QT_FORK_AWESOME_QUICK_IMAGE_PROVIDER
3
4#include "./global.h"
5
6#include <QColor>
7#include <QQuickImageProvider>
8#include <QSize>
9
10QT_FORWARD_DECLARE_CLASS(QPixmap)
11QT_FORWARD_DECLARE_CLASS(QSize)
12
13namespace QtForkAwesome {
14
15class Renderer;
16
17class QT_QUICK_FORK_AWESOME_EXPORT QuickImageProvider : public QQuickImageProvider {
18#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
19 Q_OBJECT
20 Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor)
21 Q_PROPERTY(QSize defaultSize READ defaultSize WRITE setDefaultSize)
22#endif
23
24public:
25 QuickImageProvider(const Renderer &renderer, const QColor &defaultColor = QColor(), const QSize &defaultSize = QSize(64, 64),
26 QQuickImageProvider::ImageType type = QQuickImageProvider::Pixmap);
27 QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
28 QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
29
30 QColor defaultColor() const;
31 QSize defaultSize() const;
32
33#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
34public Q_SLOTS:
35#else
36public:
37#endif
38 void setDefaultColor(const QColor &color);
39 void setDefaultSize(const QSize &size);
40
41private:
42 const Renderer &m_renderer;
43 QColor m_defaultColor;
44 QSize m_defaultSize;
45};
46
48{
49 return m_defaultColor;
50}
51
53{
54 return m_defaultSize;
55}
56
57inline void QuickImageProvider::setDefaultColor(const QColor &color)
58{
59 m_defaultColor = color;
60}
61
62inline void QuickImageProvider::setDefaultSize(const QSize &size)
63{
64 m_defaultSize = size;
65}
66
67} // namespace QtForkAwesome
68
69#endif // QT_FORK_AWESOME_QUICK_IMAGE_PROVIDER
void setDefaultSize(const QSize &size)
QuickImageProvider(const Renderer &renderer, const QColor &defaultColor=QColor(), const QSize &defaultSize=QSize(64, 64), QQuickImageProvider::ImageType type=QQuickImageProvider::Pixmap)
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override
void setDefaultColor(const QColor &color)
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override
#define QT_QUICK_FORK_AWESOME_EXPORT
Marks the symbol to be exported by the qtquickforkawesome library.
Definition global.h:14
Contains classes provided by the QtForkAwesome library.