Replace deprecated QColor::fromString in tests and documentation

Don't use deprecated methods in tests, and don't refer to them in
documentation.

Change-Id: I110480742d9a7b9b0a2e194e3fe610208c1e07da
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
bb10
Volker Hilsheimer 2022-03-21 09:02:48 +01:00
parent 4ac00ca901
commit c924c05ae2
3 changed files with 4 additions and 4 deletions

View File

@ -416,7 +416,7 @@ static QStringList get_colornames()
A color can be set by passing an RGB string (such as "#112233"),
or an ARGB string (such as "#ff112233") or a color name (such as "blue"),
to the setNamedColor() function.
to the fromString() function.
The color names are taken from the SVG 1.0 color names. The name()
function returns the name of the color in the format
"#RRGGBB". Colors can also be set using setRgb(), setHsv() and
@ -871,7 +871,7 @@ QColor::QColor(Spec spec) noexcept
Returns the name of the color in the specified \a format.
\sa setNamedColor(), NameFormat
\sa fromString(), NameFormat
*/
QString QColor::name(NameFormat format) const

View File

@ -2927,7 +2927,7 @@
| \tt{hsl(\e{h}, \e{s}, \e{l})} \br
| \tt{hsla(\e{h}, \e{s}, \e{l}, \e{a})} \br
| \tt{#\e{rrggbb}} \br
| \l{QColor::setNamedColor()}{Color Name} \br
| \l{QColor::fromString()}{Color Name} \br
\li Specifies a color as RGB (red, green, blue), RGBA (red,
green, blue, alpha), HSV (hue, saturation, value), HSVA
(hue, saturation, value, alpha), HSL (hue, saturation,

View File

@ -245,7 +245,7 @@ void tst_QGuiVariant::toColor_data()
QTest::newRow("qstring(#ff0000)") << QVariant(QString::fromUtf8("#ff0000")) << c;
QTest::newRow("qbytearray(#ff0000)") << QVariant(QByteArray("#ff0000")) << c;
c.setNamedColor("#88112233");
c = QColor::fromString("#88112233");
QTest::newRow("qstring(#88112233)") << QVariant(QString::fromUtf8("#88112233")) << c;
QTest::newRow("qbytearray(#88112233)") << QVariant(QByteArray("#88112233")) << c;
}