qmlFrontend/previewimageprovider.cpp
author unc0rr
Mon, 22 Sep 2014 02:10:39 +0400
branchqmlfrontend
changeset 10420 02c573d19224
child 10424 4be6cd55f1cf
permissions -rw-r--r--
flib: - Ability to pass raw data via IPC qmlfrontend: - Pass message received by callback through event loop to handle it in main thread - Get preview image from engine on button click and render it in Image object
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10420
unc0rr
parents:
diff changeset
     1
#include "previewimageprovider.h"
unc0rr
parents:
diff changeset
     2
unc0rr
parents:
diff changeset
     3
PreviewImageProvider::PreviewImageProvider()
unc0rr
parents:
diff changeset
     4
        : QQuickImageProvider(QQuickImageProvider::Pixmap)
unc0rr
parents:
diff changeset
     5
{
unc0rr
parents:
diff changeset
     6
}
unc0rr
parents:
diff changeset
     7
unc0rr
parents:
diff changeset
     8
QPixmap PreviewImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
unc0rr
parents:
diff changeset
     9
{
unc0rr
parents:
diff changeset
    10
    Q_UNUSED(id);
unc0rr
parents:
diff changeset
    11
    Q_UNUSED(requestedSize);
unc0rr
parents:
diff changeset
    12
unc0rr
parents:
diff changeset
    13
    if (size)
unc0rr
parents:
diff changeset
    14
        *size = m_px.size();
unc0rr
parents:
diff changeset
    15
unc0rr
parents:
diff changeset
    16
    return m_px;
unc0rr
parents:
diff changeset
    17
}
unc0rr
parents:
diff changeset
    18
unc0rr
parents:
diff changeset
    19
void PreviewImageProvider::setPixmap(const QPixmap & px)
unc0rr
parents:
diff changeset
    20
{
unc0rr
parents:
diff changeset
    21
    m_px = px;
unc0rr
parents:
diff changeset
    22
}