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());
How would I package up the QByteArray and return the data to QML? I tried to return as a QVariant but got errors.