author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 21 Jan 2019 19:49:38 +0100 | |
changeset 14670 | e7b2542c4d28 |
parent 14175 | 8354b390f1a2 |
permissions | -rw-r--r-- |
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
14164
diff
changeset
|
1 |
#include "preview_image_provider.h" |
14164 | 2 |
|
3 |
PreviewImageProvider::PreviewImageProvider() |
|
4 |
: QQuickImageProvider(QQuickImageProvider::Pixmap) {} |
|
5 |
||
6 |
QPixmap PreviewImageProvider::requestPixmap(const QString &id, QSize *size, |
|
7 |
const QSize &requestedSize) { |
|
8 |
Q_UNUSED(id); |
|
9 |
Q_UNUSED(requestedSize); |
|
10 |
||
11 |
if (size) *size = m_px.size(); |
|
12 |
||
13 |
return m_px; |
|
14 |
} |
|
15 |
||
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
14164
diff
changeset
|
16 |
void PreviewImageProvider::setImage(const QImage &preview) { |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
14164
diff
changeset
|
17 |
m_px = QPixmap::fromImage(preview, Qt::ColorOnly); |
14164 | 18 |
// QPixmap pxres(px.size()); |
19 |
// QPainter p(&pxres); |
|
20 |
||
21 |
// p.fillRect(pxres.rect(), linearGrad); |
|
22 |
// p.drawPixmap(0, 0, px); |
|
23 |
} |