- Qt 6.6
- Qt GUI
- C++ Classes
- QColor
- Qt 6.6.0 Reference Documentation

# Obsolete Members for QColor

The following members of class QColor are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(deprecated (6.6))` void | setNamedColor(const QString &name)
`(deprecated (6.6))` void | setNamedColor(QStringView name)
`(deprecated (6.6))` void | setNamedColor(QLatin1StringView name)

## Static Public Members

`(deprecated (6.6))` bool | isValidColor(const QString &name)
`(deprecated (6.6))` bool | isValidColor(QStringView name)
`(deprecated (6.6))` bool | isValidColor(QLatin1StringView name)

## Member Function Documentation

### `[static]` bool QColor::isValidColor(const QString &name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use isValidColorName() instead.

Returns `true` if the name is a valid color name and can be used to construct a valid QColor object, otherwise returns false.

It uses the same algorithm used in setNamedColor().

See also setNamedColor().

### `[static noexcept]` bool QColor::isValidColor(QStringView name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use isValidColorName() instead.

### `[static noexcept]` bool QColor::isValidColor(QLatin1StringView name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use isValidColorName() instead.

### void QColor::setNamedColor(const QString &name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use fromString() instead.

Sets the RGB value of this QColor to name, which may be in one of these formats:

- #RGB (each of R, G, and B is a single hex digit)
- #RRGGBB
- #AARRGGBB (Since 5.2)
- #RRRGGGBBB
- #RRRRGGGGBBBB
- 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". These color names work on all platforms. Note that these color names are not the same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not refer to the same color.
- `transparent` - representing the absence of a color.

The color is invalid if name cannot be parsed.

See also QColor(), name(), and isValid().

### void QColor::setNamedColor(QStringView name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use fromString() instead.

### void QColor::setNamedColor(QLatin1StringView name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use fromString() instead.