Obsolete Members for QColor
类QColor 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。
公共函数
(deprecated in 6.6) void | setNamedColor(const QString &name) |
(deprecated in 6.6) void | setNamedColor(QLatin1StringView name) |
(deprecated in 6.6) void | setNamedColor(QStringView name) |
静态公共成员
(deprecated in 6.6) bool | isValidColor(const QString &name) |
(deprecated in 6.6) bool | isValidColor(QLatin1StringView name) |
(deprecated in 6.6) bool | isValidColor(QStringView name) |
成员函数文档
[static, deprecated in 6.6]
bool QColor::isValidColor(const QString &name)
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
请使用isValidColorName() 代替。
如果name 是一个有效的颜色名称并可用于构造一个有效的QColor 对象,则返回true
,否则返回 false。
它使用与setNamedColor() 相同的算法。
另请参见 setNamedColor()。
[static noexcept, deprecated in 6.6]
bool QColor::isValidColor(QLatin1StringView name)
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
这是一个重载函数。
请使用isValidColorName() 代替。
[static noexcept, deprecated in 6.6]
bool QColor::isValidColor(QStringView name)
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
这是一个重载函数。
请使用isValidColorName() 代替。
[deprecated in 6.6]
void QColor::setNamedColor(const QString &name)
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
请使用fromString() 代替。
将QColor 的 RGB 值设置为name ,格式如下:
- #RGB (R、G、B 各为一个十六进制数字)
- #RRGGBB
- #AARRGGBB(自 5.2 版起)
- #RRRGGGBBB
- #RRRRGGGGBBBB
- 万维网联盟提供的SVG 颜色关键字名称列表中定义的颜色名称;例如 "steelblue "或" gainsboro"。这些颜色名称适用于所有平台。请注意,这些颜色名称与Qt::GlobalColor 枚举定义的颜色名称不同,例如,"green"(绿色)和Qt::green 指的不是同一种颜色。
transparent
- 代表没有颜色。
如果name 无法解析,则颜色无效。
另请参阅 QColor()、name() 和isValid()。
[deprecated in 6.6]
void QColor::setNamedColor(QLatin1StringView name)
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
这是一个重载函数。
请使用fromString() 代替。
[deprecated in 6.6]
void QColor::setNamedColor(QStringView name)
自 6.6 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
这是一个重载函数。
请使用fromString() 代替。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.