author | unC0Rr |
Tue, 04 Feb 2025 17:31:55 +0100 | |
branch | qmlrenderer |
changeset 16087 | 8da5a118120b |
parent 14371 | 90bd2c331703 |
permissions | -rw-r--r-- |
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
1 |
#include "preview_acceptor.h" |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
2 |
|
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
3 |
#include <QImage> |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
4 |
#include <QQmlEngine> |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
5 |
|
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
6 |
#include "preview_image_provider.h" |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
7 |
|
16087 | 8 |
PreviewAcceptor* PreviewAcceptor::create(QQmlEngine* engine, |
9 |
QJSEngine* jsEngine) { |
|
10 |
Q_UNUSED(jsEngine) |
|
11 |
||
12 |
return new PreviewAcceptor(engine, engine); |
|
13 |
} |
|
14 |
||
15 |
PreviewAcceptor::PreviewAcceptor(QQmlEngine* engine, QObject* parent) |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
16 |
: QObject(parent), m_previewProvider(new PreviewImageProvider()) { |
16087 | 17 |
engine->addImageProvider(QStringLiteral("preview"), m_previewProvider); |
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
18 |
} |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
19 |
|
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
20 |
void PreviewAcceptor::setImage(const QImage &preview) { |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
21 |
m_previewProvider->setImage(preview); |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
diff
changeset
|
22 |
} |