-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimageprovider.h
More file actions
66 lines (52 loc) · 1.78 KB
/
imageprovider.h
File metadata and controls
66 lines (52 loc) · 1.78 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef IMAGEPROVIDER_H
#define IMAGEPROVIDER_H
//#include <QObject>
//#include <QQuickImageProvider>
//#include <QPainter>
//#include <QQmlExtensionPlugin>
//class ImageProvider : public QQuickImageProvider
//{
// Q_OBJECT
//public:
// ImageProvider();
// //explicit ImageProvider(QObject *parent = nullptr);
// QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override
// {
// int width = 100;
// int height = 50;
// if (size)
// *size = QSize(width, height);
// QPixmap pixmap(requestedSize.width() > 0 ? requestedSize.width() : width,
// requestedSize.height() > 0 ? requestedSize.height() : height);
// pixmap.fill(QColor(id).rgba());
// // write the color name
//// QPainter painter(&pixmap);
//// QFont f = painter.font();
//// f.setPixelSize(20);
//// painter.setFont(f);
//// painter.setPen(Qt::black);
//// if (requestedSize.isValid())
//// painter.scale(requestedSize.width() / width, requestedSize.height() / height);
//// painter.drawText(QRectF(0, 0, width, height), Qt::AlignCenter, id);
// return pixmap;
// }
//signals:
//public slots:
// //virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize);
//};
//class ImageProviderExtensionPlugin : public QQmlExtensionPlugin
//{
// Q_OBJECT
// Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
//public:
// void registerTypes(const char *uri) override
// {
// Q_UNUSED(uri);
// }
// void initializeEngine(QQmlEngine *engine, const char *uri) override
// {
// Q_UNUSED(uri);
// engine->addImageProvider("provedor", new ImageProvider);
// }
//};
#endif // IMAGEPROVIDER_H