[Interest] QIcon from ARGB32 data

Filip Piechocki fpiechocki at gmail.com
Sat Jun 14 18:07:00 CEST 2014


I am really against sharing the working solutions, because you will just
copy-pasted it you will learn nothing so, here is what you have to do
(although I really thought it is clear enough...) - just translate this
"recipe" to the C++ language.

You have to split the string you pasted once before (as [3]) on the ','
character (see QString::split()) so you get the QStringList containing all
the needed numbers (but theye are kept as STRINGs). Then you have to
iterate over this list (see foreach() ) and convert every string to a
number (see QString::toInt(), I also added & 0xff to get the least
significant byte from the int, and static_casted it to uchar type, but I
don't think all of this is neccessary), and append each number to the
QByteArray. Then this byte array contains data you need, so you can use
apropiate QImage constructor (QImage(uchar *data, int width, int height,
QImage::Format format, ...) ) and the rest you already know.

BR,
Filip


On Sat, Jun 14, 2014 at 2:10 PM, Damian Ivanov <damianatorrpm at gmail.com>
wrote:

> Hello once more,
>
> Filip would you mind sharing the code with me so you got the flag?
> I tried lots of combinations... Should the data look like [1] ?
>
> 1 http://pastie.org/9289563
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140614/9010bf59/attachment.html>


More information about the Interest mailing list