I get the following when I grab a screen shot:
QPixmap originalPixmap = QPixmap::grabWidget(this);
To copy to clipboard, switch view to plain text mode
I need to convert originalPixmap to std::vector<unsigned char>.
The problem I face is when I convert this grabbed pixmap to qbytearray or qbuffer it's value becomes NULL! as an example:
qDebug() << myByteArray.size(); // 0 size
QVariant myPixmap(QPixmap(QPixmap::grabWidget(this)));
QByteArray myByteArray = myPixmap.toByteArray() ;
qDebug() << myByteArray.size(); // 0 size
To copy to clipboard, switch view to plain text mode
or
image->save(&buffer);
QPixmap originalPixmap = QPixmap::grabWidget(this);
QImage *image = new QImage(originalPixmap.toImage());
QByteArray Array;
QBuffer buffer(&Array);
buffer.open(QIODevice::WriteOnly);
image->save(&buffer);
To copy to clipboard, switch view to plain text mode
again returns null string. am I missing something in the code?
Bookmarks