QColorConstants Namespace
QColorConstants命名空间包含QColor预定义常量。
Header | #include < QColorConstants > |
---|---|
qmake | QT += gui |
Inherits | |
Inherited By | |
Since | Qt 5.14 |
详细说明
这些常量可在任何需要QColor对象的地方使用:
painter.setBrush(QColorConstants::Svg::lightblue);
它们的使用比将字符串传递给QColor的构造函数要便宜得多,因为它们不需要对字符串进行任何解析,并且总是生成一个有效的QColor对象:
object.setColor(QColor("lightblue")); // expensive
Qt Colors
以下颜色在QColorConstants命名空间中定义:
Name | Hex | Color |
---|---|---|
Color0 | #000000 | |
Color1 | #ffffff | |
Black | #000000 | |
White | #ffffff | |
DarkGray | #808080 | |
Gray | #a0a0a4 | |
LightGray | #c0c0c0 | |
Red | #ff0000 | |
Green | #00ff00 | |
Blue | #0000ff | |
Cyan | #00ffff | |
Magenta | #ff00ff | |
Yellow | #ffff00 | |
DarkRed | #800000 | |
DarkGreen | #008000 | |
DarkBlue | #000080 | |
DarkCyan | #008080 | |
DarkMagenta | #800080 | |
DarkYellow | #808000 | |
Transparent | #00000000 | (transparent) |
SVG Colors
下表列出了可用的SVG颜色。 它们在QColorConstants :: Svg内部命名空间中可用。
Name | Hex | 中文名 | Color |
---|---|---|---|
aliceblue | #F0F8FF | 爱丽丝蓝 | |
antiquewhite | #FAEBD7 | 古董白 | |
aqua | #00FFFF | 水绿 | |
aquamarine | #7FFFD4 | 宝石碧绿 | |
azure | #F0FFFF | 蔚蓝 | |
beige | #F5F5DC | 米黄 | |
bisque | #FFE4C4 | 素陶器色 | |
black | #000000 | 黑色 | |
blanchedalmond | #FFEBCD | 白杏色 | |
blue | #0000FF | 蓝色 | |
blueviolet | #8A2BE2 | 蓝紫罗兰 | |
brown | #A52A2A | 棕色 | |
burlywood | #DEB887 | 实木色 | |
cadetblue | #5F9EA0 | 军蓝 | |
chartreuse | #7FFF00 | 查特酒绿 | |
chocolate | #D2691E | 巧克力色 | |
coral | #FF7F50 | 珊瑚色 | |
cornflowerblue | #6495ED | 矢车菊蓝 | |
cornsilk | #FFF8DC | 玉米丝/米绸色 | |
crimson | #DC143C | 深红 | |
cyan | #00FFFF | 青色 | |
darkblue | #00008B | 暗蓝 | |
darkcyan | #008B8B | 暗青 | |
darkgoldenrod | #B8860B | 暗金菊黄 | |
darkgray | #A9A9A9 | 深灰 | |
darkgreen | #006400 | 暗绿 | |
darkkhaki | #BDB76B | 深卡其 | |
darkmagenta | #8B008B | 暗洋红 | |
darkolivegreen | #556B2F | 暗橄榄绿 | |
darkorange | #FF8C00 | 暗桔 | |
darkorchid | #9932CC | 暗紫 | |
darkred | #8B0000 | 暗红 | |
darksalmon | #E9967A | 暗肉色 | |
darkseagreen | #8FBC8F | 暗海洋绿 | |
darkslateblue | #483D8B | 暗板岩蓝 | |
darkslategray | #2F4F4F | 暗石板灰/墨绿 | |
darkturquoise | #00CED1 | 暗宝石绿 | |
darkviolet | #9400D3 | 暗紫 | |
deeppink | #FF1493 | 深粉 | |
deepskyblue | #00BFFF | 深天蓝 | |
dimgray | #696969 | 暗灰 | |
dodgerblue | #1E90FF | 道奇蓝/闪蓝 | |
firebrick | #B22222 | 耐火砖 | |
floralwhite | #FFFAF0 | 花白 | |
forestgreen | #228B22 | 森林绿 | |
fuchsia | #FF00FF | 紫红 | |
gainsboro | #DCDCDC | 亮灰 | |
ghostwhite | #F8F8FF | 幽灵白 | |
gold | #FFD700 | 金色 | |
goldenrod | #DAA520 | 金菊黄 | |
gray | #808080 | 灰色 | |
green | #008000 | 绿色 | |
greenyellow | #ADFF2F | 绿黄 | |
honeydew | #F0FFF0 | 白兰瓜 | |
hotpink | #FF69B4 | 热粉 | |
indianred | #CD5C5C | 印度红 | |
indigo | #4B0082 | 靛蓝 | |
ivory | #FFFFF0 | 象牙白 | |
khaki | #F0E68C | 卡其 | |
lavender | #E6E6FA | 薰衣草/淡紫 | |
lavenderblush | #FFF0F5 | 淡紫红 | |
lawngreen | #7CFC00 | 草坪绿 | |
lemonchiffon | #FFFACD | 柠檬绸 | |
lightblue | #ADD8E6 | 亮蓝 | |
lightcoral | #F08080 | 浅珊瑚 | |
lightcyan | #E0FFFF | 淡青 | |
lightgoldenrodyellow | #FAFAD2 | 亮菊黄 | |
lightgray | #D3D3D3 | 浅灰 | |
lightgreen | #90EE90 | 浅绿色 | |
lightpink | #FFB6C1 | 浅粉色 | |
lightsalmon | #FFA07A | 浅肉色 | |
lightseagreen | #20B2AA | 浅海绿 | |
lightskyblue | #87CEFA | 浅天空蓝 | |
lightslategray | #778899 | 浅青灰 | |
lightsteelblue | #B0C4DE | 亮钢蓝 | |
lightyellow | #FFFFE0 | 浅黄色 | |
lime | #00FF00 | 闪光绿 | |
limegreen | #32CD32 | 闪光深绿 | |
linen | #FAF0E6 | 亚麻布 | |
magenta | #FF00FF | 洋红 | |
maroon | #800000 | 栗色 | |
mediumaquamarine | #66CDAA | 中宝石碧绿 | |
mediumblue | #0000CD | 中蓝 | |
mediumorchid | #BA55D3 | 中兰花紫 | |
mediumpurple | #9370DB | 中紫 | |
mediumseagreen | #3CB371 | 中海洋绿 | |
mediumslateblue | #7B68EE | 中板岩蓝 | |
mediumspringgreen | #00FA9A | 中春绿 | |
mediumturquoise | #48D1CC | 中绿宝石 | |
mediumvioletred | #C71585 | 中紫罗兰红 | |
midnightblue | #191970 | 午夜蓝/中灰蓝 | |
mintcream | #F5FFFA | 薄荷奶油 | |
mistyrose | #FFE4E1 | 薄雾玫瑰 | |
moccasin | #FFE4B5 | 鹿皮靴 | |
navajowhite | #FFDEAD | 土著白 | |
navy | #000080 | 海军蓝 | |
oldlace | #FDF5E6 | 旧蕾丝 | |
olive | #808000 | 橄榄色 | |
olivedrab | #6B8E23 | 橄榄褐色 | |
orange | #FFA500 | 橙色 | |
orangered | #FF4500 | 橘红 | |
orchid | #DA70D6 | 兰花紫/淡紫 | |
palegoldenrod | #EEE8AA | 灰菊黄 | |
palegreen | #98FB98 | 弱绿 | |
paleturquoise | #AFEEEE | 弱绿宝石 | |
palevioletred | #DB7093 | 弱紫罗兰红 | |
papayawhip | #FFEFD5 | 番木色 | |
peachpuff | #FFDAB9 | 桃肉色 | |
peru | #CD853F | 秘鲁黄 | |
pink | #FFC0CB | 粉色 | |
plum | #DDA0DD | 李子紫 | |
powderblue | #B0E0E6 | 火药青 | |
purple | #800080 | 紫色 | |
red | #FF0000 | 红色 | |
rosybrown | #BC8F8F | 玫瑰棕 | |
royalblue | #4169E1 | 宝蓝 | |
saddlebrown | #8B4513 | 重褐 | |
salmon | #FA8072 | 鲑鱼肉 | |
sandybrown | #F4A460 | 黄褐 | |
seagreen | #2E8B57 | 海洋绿 | |
seashell | #FFF5EE | 海贝壳 | |
sienna | #A0522D | 黄土赭 | |
silver | #C0C0C0 | 银色 | |
skyblue | #87CEEB | 天空蓝 | |
slateblue | #6A5ACD | 板岩蓝/青蓝 | |
slategray | #708090 | 石板灰 | |
snow | #FFFAFA | 雪白 | |
springgreen | #00FF7F | 春绿 | |
steelblue | #4682B4 | 钢蓝/铁青 | |
tan | #D2B48C | 黝黑色 | |
teal | #008080 | 绿水鸭 | |
thistle | #D8BFD8 | 苍紫 | |
tomato | #FF6347 | 番茄红 | |
turquoise | #40E0D0 | 绿宝石 | |
violet | #EE82EE | 紫罗兰 | |
wheat | #F5DEB3 | 小麦色 | |
white | #FFFFFF | 白色 | |
whitesmoke | #F5F5F5 | 白烟 | |
yellow | #FFFF00 | 黄色 | |
yellowgreen | #9ACD32 | 黄绿色 |
enum Qt::GlobalColor
Qt预定义的QColor对象:
Constant | Value | Description |
---|---|---|
Qt::color0 | 0 | 0 pixel value (for bitmaps) |
Qt::color1 | 1 | 1 pixel value (for bitmaps) |
Qt::black | 2 | Black (#000000) |
Qt::white | 3 | White (#ffffff) |
Qt::darkGray | 4 | Dark gray (#808080) |
Qt::gray | 5 | Gray (#a0a0a4) |
Qt::lightGray | 6 | Light gray (#c0c0c0) |
Qt::red | 7 | Red (#ff0000) |
Qt::green | 8 | Green (#00ff00) |
Qt::blue | 9 | Blue (#0000ff) |
Qt::cyan | 10 | Cyan (#00ffff) |
Qt::magenta | 11 | Magenta (#ff00ff) |
Qt::yellow | 12 | Yellow (#ffff00) |
Qt::darkRed | 13 | Dark red (#800000) |
Qt::darkGreen | 14 | Dark green (#008000) |
Qt::darkBlue | 15 | Dark blue (#000080) |
Qt::darkCyan | 16 | Dark cyan (#008080) |
Qt::darkMagenta | 17 | Dark magenta (#800080) |
Qt::darkYellow | 18 | Dark yellow (#808000) |
Qt::transparent | 19 | a transparent black value (i.e., QColor(0, 0, 0, 0)) |