When it's about to set a Qt Pen in blue, red or green, I can do the following:
QPen(Qt::blue));
QPen(Qt::red));
QPen(Qt::orange));
But when it's about to set an orange color, it's not recognized.
Then, how to set a QPen in orange?
If you look at QColor::setNamedColor(), it states:
Sets the RGB value of this QColor to name, which may be in one of these formats: ... A name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro"...
And here is the list of names you can use.
So you can do this:
QPen pen;
pen.setColor("orange");
QColor understands SVG colors also (I find handy this graphviz page for reference). Then you can just name it:
QColor c("orange")
The same page also reports actual values: orange is #ffa500
You should use one of predefined colors, or create a custom color, for example QPen(QColor( 0xFF, 0xA0, 0x00 ))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With