OSDN Git Service

use KAT image for the QWhatsThis action, fallback to XPM
authorIvailo Monev <xakepa10@gmail.com>
Tue, 11 Oct 2022 11:52:54 +0000 (14:52 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Tue, 11 Oct 2022 11:56:28 +0000 (14:56 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/kernel/qwhatsthis.cpp

index 6b1fa1f..77edc9f 100644 (file)
@@ -308,7 +308,26 @@ void QWhatsThat::paintEvent(QPaintEvent*)
     }
 }
 
-#ifndef QT_NO_IMAGEFORMAT_XPM
+#if !defined(QT_NO_IMAGEFORMAT_KAT)
+// generated via `xxd -i <path_to_kat_image>`
+static const unsigned char button_image_bits[] = {
+    0x4b, 0x41, 0x54, 0x49, 0x45, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x83, 0x78, 0x01,
+    0x9d, 0x8d, 0x09, 0x0e, 0x83, 0x30, 0x10, 0x03, 0xf3, 0xf4, 0xfe, 0xbc,
+    0x65, 0x1c, 0x9c, 0x3a, 0xe4, 0x00, 0x31, 0xd2, 0x88, 0xac, 0x77, 0x2d,
+    0x4a, 0x29, 0xdf, 0xc3, 0x2d, 0x9f, 0xe3, 0xe6, 0xaa, 0x16, 0x15, 0xde,
+    0x39, 0x77, 0xf8, 0x1e, 0x67, 0x73, 0xf4, 0xb1, 0xc3, 0x77, 0xa8, 0xe0,
+    0xc4, 0x19, 0x46, 0xd7, 0x36, 0xe2, 0x66, 0x20, 0x76, 0x33, 0x45, 0xdc,
+    0x0c, 0xc4, 0x6e, 0xa5, 0x38, 0x6f, 0x3a, 0xc8, 0x6c, 0xdc, 0xcf, 0x1c,
+    0x70, 0x0f, 0x15, 0xd4, 0xef, 0xce, 0x86, 0x7b, 0xa8, 0xa0, 0xc2, 0xfb,
+    0xce, 0x55, 0x17, 0x98, 0xaf, 0x0e, 0xb8, 0x8b, 0x0a, 0xfe, 0x30, 0x3b,
+    0xf3, 0x1b, 0x9f, 0x92, 0xb7, 0xbc, 0x6d, 0x87, 0xff, 0x8d, 0x0a, 0xd6,
+    0xb0, 0xb7, 0x0d, 0x77, 0x51, 0xc1, 0x1a, 0xf6, 0xf6, 0x2d, 0xee, 0xe3,
+    0x1b, 0xdc, 0xc5, 0x2d, 0x3f, 0x1d, 0xde, 0x8d, 0x0b
+};
+static const unsigned int button_image_len = 165;
+#elif !defined(QT_NO_IMAGEFORMAT_XPM)
 /* XPM */
 static const char * const button_image[] = {
 "16 16 3 1",
@@ -331,7 +350,7 @@ static const char * const button_image[] = {
 "    ooo         ",
 "     ooo        ",
 "     ooo        "};
-#endif // QT_NO_IMAGEFORMAT_XPM
+#endif // QT_NO_IMAGEFORMAT_KAT
 
 class QWhatsThisPrivate : public QObject
 {
@@ -460,7 +479,11 @@ private slots:
 
 QWhatsThisAction::QWhatsThisAction(QObject *parent) : QAction(tr("What's This?"), parent)
 {
-#ifndef QT_NO_IMAGEFORMAT_XPM
+#if !defined(QT_NO_IMAGEFORMAT_KAT)
+    QPixmap p;
+    p.loadFromData(button_image_bits, button_image_len, "KAT");
+    setIcon(p);
+#elif !defined(QT_NO_IMAGEFORMAT_XPM)
     QPixmap p((const char**)button_image);
     setIcon(p);
 #endif