当它即将将Qt笔设置为蓝色、红色或绿色时,我可以这样做:
QPen(Qt::blue));
QPen(Qt::red));
QPen(Qt::orange));但是当它要设置橙色时,它就不被识别了。
那么,如何将QPen设置为橙色?
发布于 2013-10-10 10:04:57
如果您查看QColor::setNamedColor(),它会声明:
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"...
这里是您可以使用的名称列表。
所以你可以这么做:
QPen pen;
pen.setColor("orange");发布于 2013-10-10 10:02:27
发布于 2013-10-10 09:42:50
您应该使用预定义颜色之一,或者创建自定义颜色,例如QPen(QColor( 0xFF, 0xA0, 0x00 ))。
https://stackoverflow.com/questions/19292268
复制相似问题