45 #include <QtGui/qwindowdefs.h> 46 #include <QtGui/qcolor.h> 47 #include <QtGui/qbrush.h> 78 QPalette(
const QPalette &palette);
80 QPalette &operator=(
const QPalette &palette);
81 #ifdef Q_COMPILER_RVALUE_REFS 82 inline QPalette &operator=(QPalette &&other)
85 current_group = other.current_group;
86 qSwap(
d, other.d);
return *
this;
92 enum ColorGroup { Active, Disabled, Inactive, NColorGroups, Current, All, Normal = Active };
100 NColorRoles = ToolTipText + 1,
108 {
return brush(cg, cr).color(); }
111 inline void setColor(ColorRole cr,
const QColor &color);
112 inline void setBrush(ColorRole cr,
const QBrush &brush);
113 bool isBrushSet(
ColorGroup cg, ColorRole cr)
const;
146 inline QT3_SUPPORT QPalette copy()
const { QPalette p = *
this; p.
detach();
return p; }
148 inline QT3_SUPPORT
void setNormal(
const QColorGroup &cg) { setColorGroup(Active, cg); }
153 inline QT3_SUPPORT
void setActive(
const QColorGroup &cg) { setColorGroup(Active, cg); }
154 inline QT3_SUPPORT
void setDisabled(
const QColorGroup &cg) { setColorGroup(Disabled, cg); }
155 inline QT3_SUPPORT
void setInactive(
const QColorGroup &cg) { setColorGroup(Inactive, cg); }
160 bool isCopyOf(
const QPalette &p)
const;
162 int serialNumber()
const;
165 QPalette resolve(
const QPalette &)
const;
176 const QBrush &highlight,
const QBrush &highlighted_text,
184 const QBrush &highlight,
const QBrush &highlighted_text,
203 { setBrush(acg, acr,
QBrush(acolor)); }
205 { setColor(All, acr, acolor); }
207 { setBrush(All, acr, abrush); }
213 inline QColorGroup() :
QPalette() {}
214 inline QColorGroup(
const QBrush &foreground,
const QBrush &button,
const QBrush &light,
217 :
QPalette(foreground, button, light, dark, mid, text, bright_text, base, background)
219 inline QColorGroup(
const QColor &foreground,
const QColor &background,
const QColor &light,
221 :
QPalette(foreground, background, light, dark, mid, text, base) {}
222 inline QColorGroup(
const QColorGroup &cg) :
QPalette(cg) {}
224 bool operator==(
const QColorGroup &other)
const;
232 inline QT3_SUPPORT
const QColor &
mid()
const {
return color(Mid); }
246 #ifndef QT_NO_DATASTREAM 251 inline QColorGroup QPalette::inactive()
const {
return createColorGroup(Inactive); }
253 inline QColorGroup QPalette::active()
const {
return createColorGroup(Active); }
254 inline QColorGroup QPalette::normal()
const {
return createColorGroup(Active); }
261 #ifndef QT_NO_DATASTREAM 264 #endif // QT_NO_DATASTREAM The QVariant class acts like a union for the most common Qt data types.
bool operator!=(const QPalette &p) const
Returns true (slowly) if this palette is different from p; otherwise returns false (usually quickly)...
The QColor class provides colors based on RGB, HSV or CMYK values.
const QBrush & highlight() const
Returns the highlight brush of the current color group.
const QBrush & base() const
Returns the base brush of the current color group.
const QBrush & brightText() const
Returns the bright text foreground brush of the current color group.
#define QT_END_NAMESPACE
This macro expands to.
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
const QBrush & dark() const
Returns the dark brush of the current color group.
Q_GUI_EXPORT QDataStream & operator<<(QDataStream &ds, const QPalette &p)
const QBrush & background() const
Use window() instead.
friend Q_GUI_EXPORT QDataStream & operator<<(QDataStream &s, const QPalette &p)
Writes the palette, p to the stream s and returns a reference to the stream.
const QBrush & foreground() const
Use windowText() instead.
const QColor & color(ColorRole cr) const
Returns the color that has been set for the given color role in the current ColorGroup.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
ColorGroup currentColorGroup() const
Returns the palette's current color group.
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
const QBrush & light() const
Returns the light brush of the current color group.
const QBrush & midlight() const
Returns the midlight brush of the current color group.
const QBrush & mid() const
Returns the mid brush of the current color group.
const QBrush & brush(ColorRole cr) const
Returns the brush that has been set for the given color role in the current ColorGroup.
void qSwap(T &value1, T &value2)
The QBrush class defines the fill pattern of shapes drawn by QPainter.
const QBrush & shadow() const
Returns the shadow brush of the current color group.
const QBrush & windowText() const
Returns the window text (general foreground) brush of the current color group.
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
const QBrush & linkVisited() const
Returns the visited link text brush of the current color group.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
const QBrush & toolTipBase() const
Returns the tool tip base brush of the current color group.
The QColorGroup class contains color groups for each widget state.
const QBrush & toolTipText() const
Returns the tool tip text brush of the current color group.
const QBrush & alternateBase() const
Returns the alternate base brush of the current color group.
const QBrush & link() const
Returns the unvisited link text brush of the current color group.
bool operator==(const QPalette &p) const
Returns true (usually quickly) if this palette is equal to p; otherwise returns false (slowly)...
const QBrush & buttonText() const
Returns the button text foreground brush of the current color group.
The QDataStream class provides serialization of binary data to a QIODevice.
QPalette()
Constructs a palette object that uses the application's default palette.
QDataStream & operator>>(QDataStream &s, QPalette &p)
Reads a palette from the stream, s into the palette p, and returns a reference to the stream...
const QBrush & button() const
Returns the button brush of the current color group.
bool operator==(QBool b1, bool b2)
const QBrush & window() const
Returns the window (general background) brush of the current color group.
const QBrush & text() const
Returns the text foreground brush of the current color group.
The Text item allows you to add formatted text to a scene.
The QPalette class contains color groups for each widget state.