C/C++/Qt hardcoded image

You must convert an image to XMP format. You can do it with GIMP. Open the image, save as XPM (X PixMap Image) format, name of the file should end with .h (C/C++ header).
image.h

For my example content of a file is:

[spoiler effect=”slide”]

$cat icon.h
/* XPM */
static char * icon_xpm[] = {
"16 16 102 2",
"       c #2AB911",
".      c #2BB812",
"+      c #61E448",
"@      c #68DF51",
"#      c #73D662",
"$      c #79D169",
"%      c #7AD06B",
"&      c #68DE52",
"*      c #5FE548",
"=      c #2EB618",
"-      c #2FB41A",
";      c #2FB518",
">      c #28BA0F",
",      c #6DDA59",
"'      c #002800",
")      c #002300",
"!      c #002000",
"~      c #002200",
"{      c #62E34B",
"]      c #2EB616",
"^      c #33B21D",
"/      c #33B11F",
"(      c #31B31B",
"_      c #30B619",
":      c #24BD0A",
"<      c #65E051",
"[      c #001C00",
"}      c #001000",
"|      c #001300",
"1      c #001400",
"2      c #001200",
"3      c #000F00",
"4      c #001900",
"5      c #63E24D",
"6      c #65E14F",
"7      c #61E44A",
"8      c #21BF08",
"9      c #68DE54",
"0      c #001100",
"a      c #000600",
"b      c #59954F",
"c      c #5B9450",
"d      c #000D00",
"e      c #79D268",
"f      c #002F00",
"g      c #002600",
"h      c #003300",
"i      c #23BE08",
"j      c #69DD54",
"k      c #000C00",
"l      c #4D9E3F",
"m      c #3DAA29",
"n      c #3DAA2B",
"o      c #4E9F40",
"p      c #000B00",
"q      c #81CB74",
"r      c #002500",
"s      c #001D00",
"t      c #003000",
"u      c #60E349",
"v      c #43A631",
"w      c #42A731",
"x      c #000E00",
"y      c #87C77B",
"z      c #002100",
"A      c #001700",
"B      c #85C87B",
"C      c #41A630",
"D      c #000A00",
"E      c #86C97C",
"F      c #6CDB59",
"G      c #5FE44A",
"H      c #24BF09",
"I      c #3EAB2C",
"J      c #001B00",
"K      c #6DDC59",
"L      c #62E54B",
"M      c #000700",
"N      c #000900",
"O      c #002400",
"P      c #77D368",
"Q      c #38AE22",
"R      c #000400",
"S      c #81CB76",
"T      c #002C00",
"U      c #002D00",
"V      c #6BDC58",
"W      c #001800",
"X      c #5CE744",
"Y      c #2CB714",
"Z      c #6DDA5B",
"`      c #72D761",
" .     c #7BCF6D",
"..     c #001600",
"+.     c #002E00",
"@.     c #5EE646",
"#.     c #31B41A",
"$.     c #35B11F",
"%.     c #32B21D",
"&.     c #66E051",
"*.     c #70DA5E",
"=.     c #003600",
"  . + @ # $ % # & * . . = - ; ; ",
"> * , ' ) ! ! ~ ' , { ] ^ / ( _ ",
": < [ } | 1 1 2 3 4 , 5 , , 6 7 ",
"8 9 0 a | b c 2 a d e f g ' h 7 ",
"i j 0 k l m n o k p q r s ! t u ",
"i j 0 3 v ; ; w x p y z A B , 7 ",
"8 9 0 3 v ; ; C x D y z A E F G ",
"8 9 0 3 v ; ; w x D y z A s t G ",
"i j 0 3 v ; ; w x D y z A [ f 7 ",
"H j 0 k l m I o k D y ~ J q K L ",
"H j 0 M | b c 2 a N y O ~ P Q ; ",
": < J } | 1 1 3 R p S T U V ^ ; ",
"> * F ' ) ! ! W M d e 6 * X = ; ",
". Y * 6 Z ` `  ...4 +.@.> > Y ; ",
"] ] ; #./ $.%.&.*.+.=.* ] Y ] ; ",
"; ; ; ; ; ] . . * 7 L 7 ; ; ; ; "};

[/spoiler]

 

#include "image.h"
 
label = new QLabel();
label->setPixmap(QPixmap(icon_xpm));
[Total: 0    Average: 0/5]