-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageProvider.h
28 lines (22 loc) · 1.01 KB
/
ImageProvider.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef IMAGEPROVIDER_H
#define IMAGEPROVIDER_H
#include <QQuickImageProvider>
/// This class provides pixmaps to the QML Engine, you don't need to call it directly from QML.
class ImageProvider : public QQuickImageProvider
{
public:
ImageProvider();
/// aPixmapName the file name of the requested pixmap
/// @aFinalSizePtr OUTPUT pointer to a size struct with the final size of the pixmap
/// @aRequestedSize (if provided) the requested size of the pixmap
QPixmap requestPixmap(const QString &aPixmapName,
QSize *aFinalSizePr,
const QSize &aRequestedSize) override;
/// Simple static, public member: adds "image://tbe/" in front of image name.
/// Used to ensure we don't have "image://tbe/" everywhere in the code.
/// @returns anImageName, prepended with "image://tbe/"
static QString setPath(QString& anImageName)
{ return "image://tbe/"+anImageName; }
};
#define IMG(A) ImageProvider::setPath(A)
#endif // IMAGEPROVIDER_H