7#include <QtGui/qtguiglobal.h>
9#include <QtCore/qnamespace.h>
10#include <QtCore/qstringlist.h>
11#include <QtGui/qrgba64.h>
22#ifndef QT_NO_DEBUG_STREAM
25#ifndef QT_NO_DATASTREAM
39 : cspec(
Invalid), ct(USHRT_MAX, 0, 0, 0, 0) {}
41 constexpr QColor(
int r,
int g,
int b,
int a = 255) noexcept
52 inline QColor(
const char *aname);
54 QColor(Spec spec)
noexcept;
60 bool isValid() const noexcept;
64#if QT_DEPRECATED_SINCE(6, 6)
78 int alpha() const noexcept;
79 void setAlpha(
int alpha);
81 float alphaF() const noexcept;
82 void setAlphaF(
float alpha);
84 int red() const noexcept;
85 int green() const noexcept;
86 int blue() const noexcept;
88 void setGreen(
int green);
89 void setBlue(
int blue);
91 float redF() const noexcept;
92 float greenF() const noexcept;
93 float blueF() const noexcept;
94 void setRedF(
float red);
95 void setGreenF(
float green);
96 void setBlueF(
float blue);
98 void getRgb(
int *
r,
int *
g,
int *
b,
int *
a =
nullptr) const;
99 void setRgb(
int r,
int g,
int b,
int a = 255);
101 void getRgbF(
float *
r,
float *
g,
float *
b,
float *
a =
nullptr) const;
102 void setRgbF(
float r,
float g,
float b,
float a = 1.0);
104 QRgba64 rgba64() const noexcept;
105 void setRgba64(
QRgba64 rgba) noexcept;
107 QRgb rgba() const noexcept;
108 void setRgba(
QRgb rgba) noexcept;
111 void setRgb(
QRgb rgb) noexcept;
113 int hue() const noexcept;
114 int saturation() const noexcept;
115 int hsvHue() const noexcept;
116 int hsvSaturation() const noexcept;
117 int value() const noexcept;
119 float hueF() const noexcept;
120 float saturationF() const noexcept;
121 float hsvHueF() const noexcept;
122 float hsvSaturationF() const noexcept;
123 float valueF() const noexcept;
125 void getHsv(
int *
h,
int *
s,
int *
v,
int *
a =
nullptr) const;
126 void setHsv(
int h,
int s,
int v,
int a = 255);
128 void getHsvF(
float *
h,
float *
s,
float *
v,
float *
a =
nullptr) const;
129 void setHsvF(
float h,
float s,
float v,
float a = 1.0);
131 int cyan() const noexcept;
132 int magenta() const noexcept;
133 int yellow() const noexcept;
134 int black() const noexcept;
136 float cyanF() const noexcept;
137 float magentaF() const noexcept;
138 float yellowF() const noexcept;
139 float blackF() const noexcept;
141 void getCmyk(
int *
c,
int *
m,
int *
y,
int *k,
int *
a =
nullptr) const;
142 void setCmyk(
int c,
int m,
int y,
int k,
int a = 255);
144 void getCmykF(
float *
c,
float *
m,
float *
y,
float *k,
float *
a =
nullptr) const;
145 void setCmykF(
float c,
float m,
float y,
float k,
float a = 1.0);
147 int hslHue() const noexcept;
148 int hslSaturation() const noexcept;
149 int lightness() const noexcept;
151 float hslHueF() const noexcept;
152 float hslSaturationF() const noexcept;
153 float lightnessF() const noexcept;
155 void getHsl(
int *
h,
int *
s,
int *l,
int *
a =
nullptr) const;
156 void setHsl(
int h,
int s,
int l,
int a = 255);
158 void getHslF(
float *
h,
float *
s,
float *l,
float *
a =
nullptr) const;
159 void setHslF(
float h,
float s,
float l,
float a = 1.0);
161 QColor toRgb() const noexcept;
162 QColor toHsv() const noexcept;
163 QColor toCmyk() const noexcept;
164 QColor toHsl() const noexcept;
165 QColor toExtendedRgb() const noexcept;
167 [[nodiscard]]
QColor convertTo(Spec colorSpec) const noexcept;
172 static
QColor fromRgb(
int r,
int g,
int b,
int a = 255);
173 static
QColor fromRgbF(
float r,
float g,
float b,
float a = 1.0);
178 static
QColor fromHsv(
int h,
int s,
int v,
int a = 255);
179 static
QColor fromHsvF(
float h,
float s,
float v,
float a = 1.0);
181 static
QColor fromCmyk(
int c,
int m,
int y,
int k,
int a = 255);
182 static
QColor fromCmykF(
float c,
float m,
float y,
float k,
float a = 1.0);
184 static
QColor fromHsl(
int h,
int s,
int l,
int a = 255);
185 static
QColor fromHslF(
float h,
float s,
float l,
float a = 1.0);
187 [[nodiscard]]
QColor lighter(
int f = 150) const noexcept;
188 [[nodiscard]]
QColor darker(
int f = 200) const noexcept;
190 bool operator==(const
QColor &
c) const noexcept;
191 bool operator!=(const
QColor &
c) const noexcept;
195#if QT_DEPRECATED_SINCE(6, 6)
207 void invalidate() noexcept;
216#ifdef Q_COMPILER_UNIFORM_INIT
260#ifndef QT_NO_DATASTREAM
265#ifdef Q_COMPILER_UNIFORM_INIT
268 : cspec(spec), ct(
a1,
a2,
a3, a4, a5) {}
The QColor class provides colors based on RGB, HSV or CMYK values.
Spec
The type of color specified, either RGB, extended RGB, HSV, CMYK or HSL.
constexpr QColor() noexcept
Constructs an invalid color with the RGB value (0, 0, 0).
Spec spec() const noexcept
Returns how the color was specified.
constexpr QColor(int r, int g, int b, int a=255) noexcept
Constructs a color with the RGB value r, g, b, and the alpha-channel (transparency) value of a.
NameFormat
How to format the output of the name() function.
bool isValid() const noexcept
Returns true if the color is valid; otherwise returns false.
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
constexpr QColor saddlebrown
constexpr QColor firebrick
constexpr QColor darkorange
constexpr QColor lightslategrey
constexpr QColor lightslategray
constexpr QColor forestgreen
constexpr QColor antiquewhite
constexpr QColor sandybrown
constexpr QColor orangered
constexpr QColor darkgray
constexpr QColor darkturquoise
constexpr QColor mediumslateblue
constexpr QColor lightskyblue
constexpr QColor lawngreen
constexpr QColor mediumvioletred
constexpr QColor dodgerblue
constexpr QColor lightgrey
constexpr QColor deepskyblue
constexpr QColor palegoldenrod
constexpr QColor mediumspringgreen
constexpr QColor mediumorchid
constexpr QColor lightcyan
constexpr QColor mediumaquamarine
constexpr QColor darkcyan
constexpr QColor lightgray
constexpr QColor darkslateblue
constexpr QColor lightgreen
constexpr QColor steelblue
constexpr QColor gainsboro
constexpr QColor midnightblue
constexpr QColor palevioletred
constexpr QColor rosybrown
constexpr QColor lightpink
constexpr QColor royalblue
constexpr QColor darkgoldenrod
constexpr QColor slategray
constexpr QColor cornflowerblue
constexpr QColor blanchedalmond
constexpr QColor darkslategray
constexpr QColor mediumblue
constexpr QColor limegreen
constexpr QColor aquamarine
constexpr QColor paleturquoise
constexpr QColor mintcream
constexpr QColor darkblue
constexpr QColor mediumpurple
constexpr QColor cornsilk
constexpr QColor lightsalmon
constexpr QColor greenyellow
constexpr QColor darkmagenta
constexpr QColor yellowgreen
constexpr QColor navajowhite
constexpr QColor slategrey
constexpr QColor powderblue
constexpr QColor lemonchiffon
constexpr QColor whitesmoke
constexpr QColor mistyrose
constexpr QColor aliceblue
constexpr QColor peachpuff
constexpr QColor seagreen
constexpr QColor darkslategrey
constexpr QColor deeppink
constexpr QColor darkolivegreen
constexpr QColor slateblue
constexpr QColor honeydew
constexpr QColor papayawhip
constexpr QColor darkkhaki
constexpr QColor ghostwhite
constexpr QColor cadetblue
constexpr QColor lavenderblush
constexpr QColor turquoise
constexpr QColor darkorchid
constexpr QColor moccasin
constexpr QColor lightblue
constexpr QColor floralwhite
constexpr QColor lightsteelblue
constexpr QColor mediumseagreen
constexpr QColor lightcoral
constexpr QColor blueviolet
constexpr QColor darkgrey
constexpr QColor lightyellow
constexpr QColor indianred
constexpr QColor olivedrab
constexpr QColor darksalmon
constexpr QColor lightseagreen
constexpr QColor lavender
constexpr QColor mediumturquoise
constexpr QColor chocolate
constexpr QColor lightgoldenrodyellow
constexpr QColor chartreuse
constexpr QColor palegreen
constexpr QColor darkviolet
constexpr QColor darkgreen
constexpr QColor burlywood
constexpr QColor goldenrod
constexpr QColor springgreen
constexpr QColor seashell
constexpr QColor darkseagreen
constexpr QColor DarkYellow
constexpr QColor DarkGreen
constexpr QColor DarkGray
constexpr QColor DarkBlue
constexpr QColor LightGray
constexpr QColor DarkMagenta
constexpr QColor DarkCyan
constexpr QColor Transparent
Combined button and popup list for selecting options.
Q_GUI_EXPORT QDebug operator<<(QDebug, const QColor &)
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QColor &)
#define Q_DECL_CONST_FUNCTION
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
GLfloat GLfloat GLfloat alpha
static bool fromString(const QMetaObject *mo, QString s, Allocate &&allocate)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
#define QT_DEPRECATED_VERSION_X_6_6(text)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)