How to return pixels from QPixmap to QML



  • How would one return Image bits to QML from C++?

    I have this code in c++:

    @
    QImage image = m_pixmap.copy(sx, sy, sw, sh).toImage();

    image = image.convertToFormat(QImage::Format_ARGB32);
    QByteArray bytes((char *) image.bits(), image.byteCount());

    return ?????
    @

    How would I package up the QByteArray and return the data to QML? I tried to return as a QVariant but got errors.

    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.