[Qt-interest] Convert from a QPixmap into a QByteArray, and back
Gabriele Kahlout
gabriele at mysimpatico.com
Tue May 18 23:53:56 CEST 2010
Hello,
In the process of debugging I've found myself unable to assert the following
code:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
const QPixmap screen =
QPixmap::grabWindow(QApplication::desktop()->winId());
QByteArray *bytes = new QByteArray();
QDataStream out(bytes, QIODevice::WriteOnly);
out << screen;
QPixmap* screen1 = new QPixmap();
screen1->loadFromData(bytes->data());
std::cout << screen1->save("7777.png", "PNG") << endl;
std::cout << screen.save("6666.png", "PNG") << endl;
return a.exec();
}
All I'm doing is trying to convert from a QPixmap into a QByteArray, and
back. Although the code is mostly verbatim from QPixmap and QDataStream, it
doens't work. Indeed screen1 fails to save into 7777.png.
Your help, fixing this code, is greatly appreciated.
--
Regards,
K. Gabriele
--- unchanged since 25/1/10 ---
P.S. Unless a notification (LON), please reply either with an answer OR with
" ACK" appended to this subject within 48 hours. Otherwise, I might resend.
In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x, this)
∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧
¬IsAnswerTo(x,this)) ⇒ ¬IResend(this).
Also note that correspondence may be received only from specified a priori
senders, or if the subject of this email ends with a code, eg. -LICHT01X,
then also from senders whose reply contains it.
∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y. In(y,
subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100518/9392fa2b/attachment.html
More information about the Qt-interest-old
mailing list