Debian Codegraph @

tests/qcolor-from-literal/main.cpp

raw
1 #include <QtGui/QColor>
2
3 extern void takingColor(QColor);
4
5 void test()
6 {
7 QColor c1; // OK
8 QColor c2("#001020"); // Warning
9 QColor c3(QString("#001020")); // Warning. TODO
10 QColor c4(QLatin1String("#001020")); // Warning. TODO
11 QColor c5("#023"); // Warning
12 QColor c6("#00112233"); // Warning
13 QColor c7("#000111222"); // Warning
14 QColor c8("#000011112222"); // Warning
15 c4.setNamedColor("red"); // OK
16 c4.setNamedColor("#001020"); // Warning
17 c4.setNamedColor(QLatin1String("#001020")); // Warning
18 takingColor("#001122"); // Warning
19
20 // Invalid patterns
21 QColor invalidPattern1("#0000011112222"); // Warning, one digit too much
22 QColor invalidPattern2("#G00011112222"); // Warning, not a proper hex code
23 }