QPen in Orange?

When he is going to install the Qt Pen in blue, red or green, I can do the following:

QPen(Qt::blue));
QPen(Qt::red));
QPen(Qt::orange));

But when it is about to set the color orange, it is not recognized.

Then, how to set QPen in orange?

+4
source share
5 answers

If you look at QColor :: setNamedColor () , it says:

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 a list of names that you can use.

So you can do this:

QPen pen;
pen.setColor("orange");
+6
source

QColor also understands SVG colors (I can find this graphviz page for reference). Then you can simply name it:

QColor c("orange")

Actual values ​​are also shown on the same page: orange #ffa500

+2

, QPen(QColor( 0xFF, 0xA0, 0x00 ))

+1

Qt:: GlobalCOlor ? QT:: orange ! , QPen QColor.

+1

QPen QColor, RGB .

QColor orangeColor(255,165,0);
QPen(orangeColor);

RGB .

+1

All Articles