1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the gui module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
30
#include "qapplication.h"
32
#include "qdatastream.h"
35
static int qt_palette_count = 1;
36
class QPalettePrivate {
38
QPalettePrivate() : ref(1), ser_no(qt_palette_count++) { }
40
QBrush br[QPalette::NColorGroups][QPalette::NColorRoles];
44
static QColor qt_mix_colors(QColor a, QColor b)
46
return QColor((a.red() + b.red()) / 2, (a.green() + b.green()) / 2,
47
(a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2);
52
#ifndef QT_NO_DATASTREAM
53
QDataStream &qt_stream_out_qcolorgroup(QDataStream &s, const QColorGroup &g)
55
if(s.version() == 1) {
57
s << g.color(QPalette::Foreground) << g.color(QPalette::Background)
58
<< g.color(QPalette::Light) << g.color(QPalette::Dark)
59
<< g.color(QPalette::Mid) << g.color(QPalette::Text) << g.color(QPalette::Base);
61
int max = QPalette::NColorRoles;
62
if(s.version() <= 3) // Qt 2.x
64
for(int r = 0 ; r < max ; r++)
65
s << g.brush((QPalette::ColorRole)r);
70
QDataStream &qt_stream_in_qcolorgroup(QDataStream &s, QColorGroup &g)
72
if(s.version() == 1) { // Qt 1.x
73
QColor fg, bg, light, dark, mid, text, base;
74
s >> fg >> bg >> light >> dark >> mid >> text >> base;
76
p.setColor(QPalette::Active, QPalette::Foreground, fg);
77
p.setColor(QPalette::Active, QPalette::Light, light);
78
p.setColor(QPalette::Active, QPalette::Dark, dark);
79
p.setColor(QPalette::Active, QPalette::Mid, mid);
80
p.setColor(QPalette::Active, QPalette::Text, text);
81
p.setColor(QPalette::Active, QPalette::Base, base);
83
g.setCurrentColorGroup(QPalette::Active);
85
int max = QPalette::NColorRoles;
86
if (s.version() <= 3) // Qt 2.x
88
else if (s.version() <= 4) // Qt 3.x
91
for(int r = 0 ; r < max; r++) {
93
g.setBrush((QPalette::ColorRole)r, tmp);
99
QDataStream &operator<<(QDataStream &s, const QColorGroup &g)
101
return qt_stream_out_qcolorgroup(s, g);
104
QDataStream &operator>>(QDataStream &s, QColorGroup &g)
106
return qt_stream_in_qcolorgroup(s, g);
111
Constructs a palette with the specified \a active, \a disabled and
112
\a inactive color groups.
114
QPalette::QPalette(const QColorGroup &active, const QColorGroup &disabled,
115
const QColorGroup &inactive)
118
setColorGroup(Active, active);
119
setColorGroup(Disabled, disabled);
120
setColorGroup(Inactive, inactive);
123
QColorGroup QPalette::createColorGroup(ColorGroup cr) const
125
QColorGroup ret(*this);
126
ret.setCurrentColorGroup(cr);
130
void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g)
132
setColorGroup(cg, g.brush(Foreground), g.brush(Button), g.brush(Light),
133
g.brush(Dark), g.brush(Mid), g.brush(Text), g.brush(BrightText),
134
g.brush(Base), g.brush(AlternateBase), g.brush(Background),
135
g.brush(Midlight), g.brush(ButtonText), g.brush(Shadow),
136
g.brush(Highlight), g.brush(HighlightedText), g.brush(Link),
137
g.brush(LinkVisited));
143
\fn const QColor &QPalette::color(ColorRole r) const
147
Returns the color that has been set for color role \a r in the current ColorGroup.
149
\sa brush() ColorRole
153
\fn const QBrush &QPalette::brush(ColorRole r) const
157
Returns the brush that has been set for color role \a r in the current ColorGroup.
159
\sa color() setBrush() ColorRole
163
\fn void QPalette::setColor(ColorRole r, const QColor &c)
167
Sets the brush used for color role \a r in the current ColorGroup to a solid color \a c.
169
\sa brush() setColor() ColorRole
173
\fn void QPalette::setBrush(ColorRole cr, const QBrush &brush)
175
Sets the brush used to color role \a cr and brush \a brush.
177
\sa brush() setColor() ColorRole
181
\fn const QBrush & QPalette::foreground() const
183
Returns the foreground brush of the current color group.
185
\sa ColorRole brush()
189
\fn const QBrush & QPalette::button() const
191
Returns the button brush of the current color group.
193
\sa ColorRole brush()
197
\fn const QBrush & QPalette::light() const
199
Returns the light brush of the current color group.
201
\sa ColorRole brush()
205
\fn const QBrush& QPalette::midlight() const
207
Returns the midlight brush of the current color group.
209
\sa ColorRole brush()
213
\fn const QBrush & QPalette::dark() const
215
Returns the dark brush of the current color group.
217
\sa ColorRole brush()
221
\fn const QBrush & QPalette::mid() const
223
Returns the mid brush of the current color group.
225
\sa ColorRole brush()
229
\fn const QBrush & QPalette::text() const
231
Returns the text foreground brush of the current color group.
233
\sa ColorRole brush()
237
\fn const QBrush & QPalette::brightText() const
239
Returns the bright text foreground brush of the current color group.
241
\sa ColorRole brush()
245
\fn const QBrush & QPalette::buttonText() const
247
Returns the button text foreground brush of the current color group.
249
\sa ColorRole brush()
253
\fn const QBrush & QPalette::base() const
255
Returns the base brush of the current color group.
257
\sa ColorRole brush()
261
\fn const QBrush & QPalette::alternateBase() const
263
Returns the alternate base brush of the current color group.
265
\sa ColorRole brush()
269
\fn const QBrush & QPalette::background() const
271
Returns the background brush of the current color group.
273
\sa ColorRole brush()
277
\fn const QBrush & QPalette::shadow() const
279
Returns the shadow brush of the current color group.
281
\sa ColorRole brush()
285
\fn const QBrush & QPalette::highlight() const
287
Returns the highlight brush of the current color group.
289
\sa ColorRole brush()
293
\fn const QBrush & QPalette::highlightedText() const
295
Returns the highlighted text brush of the current color group.
297
\sa ColorRole brush()
301
\fn const QBrush & QPalette::link() const
303
Returns the unvisited link text brush of the current color group.
305
\sa ColorRole brush()
309
\fn const QBrush & QPalette::linkVisited() const
311
Returns the visited link text brush of the current color group.
313
\sa ColorRole brush()
317
\fn ColorGroup QPalette::currentColorGroup() const
319
Returns the palette's current color group.
323
\fn void QPalette::setCurrentColorGroup(ColorGroup cg)
325
Set the palette's current color group to \a cg.
329
\class QPalette qpalette.h
331
\brief The QPalette class contains color groups for each widget state.
338
A palette consists of three color groups: \e Active, \e Disabled,
339
and \e Inactive. All widgets in Qt contain a palette and
340
use their palette to draw themselves. This makes the user
341
interface easily configurable and easier to keep consistent.
343
If you create a new widget we strongly recommend that you use the
344
colors in the palette rather than hard-coding specific colors.
348
\i The Active group is used for the window that has keyboard focus.
349
\i The Inactive group is used for other windows.
350
\i The Disabled group is used for widgets (not windows) that are
351
disabled for some reason.
354
Both active and inactive windows can contain disabled widgets.
355
(Disabled widgets are often called \e inaccessible or \e{grayed
358
In most styles, Active and Inactive look the same.
360
Colors and brushes can be set for particular roles in any of a palette's
361
color groups with setColor() and setBrush(). A color group contains a
362
group of colors used by widgets for drawing themselves. We recommend that
363
widgets use color group roles from the palette such as "foreground" and
364
"base" rather than literal colors like "red" or "turquoise". The color
365
roles are enumerated and defined in the \l ColorRole documentation.
367
We strongly recommend that you use a system-supplied color group
368
and modify that as necessary.
370
To modify a color group you call the functions
371
setColor() and setBrush(), depending on whether you want a pure
372
color or a pixmap pattern.
374
There are also corresponding color() and brush() getters, and a
375
commonly used convenience function to get the ColorRole for the current ColorGroup:
376
background(), foreground(), base(), etc.
378
You can copy a palette using the copy constructor and test to see
379
if two palettes are \e identical using isCopyOf().
381
QPalette is optimized by the use of \link shclass.html implicit
382
sharing\endlink, so it is very efficient to pass QPalette objects as
385
\sa QApplication::setPalette(), QWidget::setPalette(), QColor
389
\enum QPalette::ColorGroup
394
\value Normal synonym for Active
397
\omitvalue NColorGroups
402
\enum QPalette::ColorRole
404
The ColorRole enum defines the different symbolic color roles used
407
The central roles are:
409
\value Background A general background color.
411
\value Foreground A general foreground color.
413
\value Base Used as the background color for text entry widgets;
414
usually white or another light color.
416
\value AlternateBase Used as the alternate background color in views with
417
alternating row colors (see
418
QAbstractItemView::setAlternatingRowColors()).
420
\value Text The foreground color used with \c Base. This is usually
421
the same as the \c Foreground, in which case it must provide
422
good contrast with \c Background and \c Base.
424
\value Button The general button background color. This background can be different from
425
\c Background as some styles require a different background color for buttons.
427
\value ButtonText A foreground color used with the \c Button color.
429
There are some color roles used mostly for 3D bevel and shadow effects.
430
All of these are normally derived from \c Background, and used in ways that
431
depend on that relationship. For example, buttons depend on it to make the
432
bevels look attractive, and Motif scroll bars depend on \c Mid to be
433
slightly different from \c Background.
435
\value Light Lighter than \c Button color.
437
\value Midlight Between \c Button and \c Light.
439
\value Dark Darker than \c Button.
441
\value Mid Between \c Button and \c Dark.
443
\value Shadow A very dark color. By default, the shadow color is
447
Selected (marked) items have two roles:
449
\value Highlight A color to indicate a selected item or the current
450
item. By default, the highlight color is
453
\value HighlightedText A text color that contrasts with \c Highlight.
454
By default, the highlighted text color is \c Qt::white.
456
Finally, there is a special role for text that needs to be drawn where \c
457
Text or \c Foreground would give poor contrast, such as on pressed push
458
buttons. Note that text colors can be used for things other than just
459
words; text colors are \e usually used for text, but it's quite common to
460
use the text color roles for lines, icons, etc.
462
\value BrightText A text color that is very different from
463
\c Foreground, and contrasts well with e.g. \c Dark.
465
\value Link A text color used for unvisited hyperlinks.
466
By default, the link color is \c Qt::blue.
468
\value LinkVisited A text color used for already visited hyperlinks.
469
By default, the linkvisited color is \c Qt::magenta.
471
\omitvalue NColorRoles
475
This image shows most of the color roles in use:
476
\img palette.png Color Roles
480
Constructs a palette object that uses the application's default palette.
482
\sa QApplication::setPalette(), QApplication::palette()
485
: d(QApplication::palette().d),
486
current_group(Active),
492
static void qt_palette_from_color(QPalette &pal, const QColor & button)
498
bg.getHsv(&h, &s, &v);
506
//inactive and active are the same..
507
pal.setColorGroup(QPalette::Active, QBrush(fg), QBrush(btn), QBrush(btn.light(150)),
508
QBrush(btn.dark()), QBrush(btn.dark(150)), QBrush(fg), QBrush(Qt::white),
509
QBrush(base), QBrush(bg));
510
pal.setColorGroup(QPalette::Inactive, QBrush(fg), QBrush(btn), QBrush(btn.light(150)),
511
QBrush(btn.dark()), QBrush(btn.dark(150)), QBrush(fg), QBrush(Qt::white),
512
QBrush(base), QBrush(bg));
513
pal.setColorGroup(QPalette::Disabled, QBrush(btn.dark()), QBrush(btn), QBrush(btn.light(150)),
514
QBrush(btn.dark()), QBrush(btn.dark(150)), QBrush(btn.dark()),
515
QBrush(Qt::white), QBrush(bg), QBrush(bg));
520
Constructs a palette from the \a button color. The other colors are
521
automatically calculated, based on this color. Background will be
522
the button color as well.
524
QPalette::QPalette(const QColor &button)
527
qt_palette_from_color(*this, button);
531
Constructs a palette from the \a button color. The other colors are
532
automatically calculated, based on this color. Background will be
533
the button color as well.
535
QPalette::QPalette(Qt::GlobalColor button)
538
qt_palette_from_color(*this, button);
542
Constructs a palette. You can pass either brushes, pixmaps or
543
plain colors for \a foreground, \a button, \a light, \a dark, \a
544
mid, \a text, \a bright_text, \a base and \a background.
548
QPalette::QPalette(const QBrush &foreground, const QBrush &button,
549
const QBrush &light, const QBrush &dark,
550
const QBrush &mid, const QBrush &text,
551
const QBrush &bright_text, const QBrush &base,
552
const QBrush &background)
555
setColorGroup(All, foreground, button, light, dark, mid, text, bright_text,
562
Constructs a palette with the specified \a foreground, \a
563
background, \a light, \a dark, \a mid, \a text, and \a base colors.
564
The button color will be set to the background color.
566
QPalette::QPalette(const QColor &foreground, const QColor &background,
567
const QColor &light, const QColor &dark, const QColor &mid,
568
const QColor &text, const QColor &base)
571
setColorGroup(All, QBrush(foreground), QBrush(background), QBrush(light),
572
QBrush(dark), QBrush(mid), QBrush(text), QBrush(light),
573
QBrush(base), QBrush(background));
577
Constructs a palette from a \a button color and a \a background.
578
The other colors are automatically calculated, based on these
581
QPalette::QPalette(const QColor &button, const QColor &background)
584
QColor bg = background, btn = button, fg, base, disfg;
586
bg.getHsv(&h, &s, &v);
590
disfg = Qt::darkGray;
594
disfg = Qt::darkGray;
596
//inactive and active are identical
597
setColorGroup(Inactive, QBrush(fg), QBrush(btn), QBrush(btn.light(150)), QBrush(btn.dark()),
598
QBrush(btn.dark(150)), QBrush(fg), QBrush(Qt::white), QBrush(base),
600
setColorGroup(Active, QBrush(fg), QBrush(btn), QBrush(btn.light(150)), QBrush(btn.dark()),
601
QBrush(btn.dark(150)), QBrush(fg), QBrush(Qt::white), QBrush(base),
603
setColorGroup(Disabled, QBrush(disfg), QBrush(btn), QBrush(btn.light(150)),
604
QBrush(btn.dark()), QBrush(btn.dark(150)), QBrush(disfg),
605
QBrush(Qt::white), QBrush(base), QBrush(bg));
609
Constructs a copy of \a p.
611
This constructor is fast because of \link shclass.html implicit sharing\endlink.
613
QPalette::QPalette(const QPalette &p)
617
resolve_mask = p.resolve_mask;
618
current_group = p.current_group;
622
Destroys the palette.
624
QPalette::~QPalette()
631
void QPalette::init() {
632
d = new QPalettePrivate;
634
current_group = Active; //as a default..
638
Assigns \a p to this palette and returns a reference to this
641
This operation is fast because of \link shclass.html implicit sharing\endlink.
643
QPalette &QPalette::operator=(const QPalette &p)
645
QPalettePrivate *x = p.d;
647
resolve_mask = p.resolve_mask;
648
current_group = p.current_group;
649
x = qAtomicSetPtr(&d, x);
656
Returns the palette as a QVariant
658
QPalette::operator QVariant() const
660
return QVariant(QVariant::Palette, this);
664
\fn const QColor &QPalette::color(ColorGroup gr, ColorRole r) const
665
Returns the color in color group \a gr, used for color role \a r.
667
\sa brush() setColor() ColorRole
671
Returns the brush in color group \a gr, used for color role \a cr.
673
\sa color() setBrush() ColorRole
675
const QBrush &QPalette::brush(ColorGroup gr, ColorRole cr) const
677
Q_ASSERT(cr < NColorRoles);
678
if(gr >= (int)NColorGroups) {
680
gr = (ColorGroup)current_group;
682
qWarning("QPalette::brush: Unknown ColorGroup: %d", (int)gr);
686
return d->br[gr][cr];
690
\fn void QPalette::setColor(ColorGroup gr, ColorRole r, const QColor &c)
691
Sets the brush in color group \a gr, used for color role \a r, to
692
the solid color \a c.
694
\sa setBrush() color() ColorRole
700
Sets the brush in color group \a cg, used for color role \a cr, to
703
\sa brush() setColor() ColorRole
705
void QPalette::setBrush(ColorGroup cg, ColorRole cr, const QBrush &b)
707
Q_ASSERT(cr < NColorRoles);
709
if(cg >= (int)NColorGroups) {
711
for(int i = 0; i < (int)NColorGroups; i++)
713
resolve_mask |= (1<<cr);
715
} else if(cg == Current) {
716
cg = (ColorGroup)current_group;
718
qWarning("QPalette::setBrush: Unknown ColorGroup: %d", (int)cg);
723
resolve_mask |= (1<<cr);
729
\fn void QPalette::detach()
730
Detaches this palette from any other QPalette objects with which
731
it might implicitly share QColorGroup objects. In essence, does
732
the copying part of copy-on-write.
734
Calling this should generally not be necessary; QPalette calls it
735
itself when necessary.
737
void QPalette::detach()
740
QPalettePrivate *x = new QPalettePrivate;
741
for(int grp = 0; grp < (int)NColorGroups; grp++) {
742
for(int role = 0; role < (int)NColorRoles; role++)
743
x->br[grp][role] = d->br[grp][role];
745
x = qAtomicSetPtr(&d, x);
752
\fn bool QPalette::operator!=(const QPalette &p) const
754
Returns true (slowly) if this palette is different from \a p;
755
otherwise returns false (usually quickly).
759
Returns true (usually quickly) if this palette is equal to \a p;
760
otherwise returns false (slowly).
762
bool QPalette::operator==(const QPalette &p) const
766
for(int grp = 0; grp < (int)NColorGroups; grp++) {
767
for(int role = 0; role < (int)NColorRoles; role++) {
768
if(d->br[grp][role] != p.d->br[grp][role])
776
bool QColorGroup::operator==(const QColorGroup &other) const
780
for (int role = 0; role < int(NColorRoles); role++) {
781
if(d->br[current_group][role] != other.d->br[other.current_group][role])
788
Returns the color group as a QVariant
790
QColorGroup::operator QVariant() const
792
return QVariant(QVariant::ColorGroup, this);
797
\fn bool QPalette::isEqual(ColorGroup cg1, ColorGroup cg2) const
799
Returns true (usually quickly) if color group \a cg1 is equal to
800
\a cg2; otherwise returns false.
802
bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2) const
804
if(group1 >= (int)NColorGroups) {
805
if(group1 == Current) {
806
group1 = (ColorGroup)current_group;
808
qWarning("QPalette::brush: Unknown ColorGroup(1): %d", (int)group1);
812
if(group2 >= (int)NColorGroups) {
813
if(group2 == Current) {
814
group2 = (ColorGroup)current_group;
816
qWarning("QPalette::brush: Unknown ColorGroup(2): %d", (int)group2);
822
for(int role = 0; role < (int)NColorRoles; role++) {
823
if(d->br[group1][role] != d->br[group2][role])
830
\fn int QPalette::serialNumber() const
832
Returns a number that uniquely identifies this QPalette object.
833
The serial number is intended for caching. Its value may not be
834
used for anything other than equality testing.
836
Note that QPalette uses implicit sharing, and the serial number changes
837
during the lazy copy operation (when the palette is actually modified), not
838
during a shallow copy (copy constructor or assignment).
840
\sa QPixmap QPixmapCache QCache
842
int QPalette::serialNumber() const
848
Returns a new QPalette that has attributes copied from \a other.
850
QPalette QPalette::resolve(const QPalette &other) const
852
if (*this == other && resolve_mask == other.resolve_mask
853
|| resolve_mask == 0) {
855
o.resolve_mask = resolve_mask;
859
QPalette palette(*this);
862
for(int role = 0; role < (int)NColorRoles; role++)
863
if (!(resolve_mask & (1<<role)))
864
for(int grp = 0; grp < (int)NColorGroups; grp++)
865
palette.d->br[grp][role] = other.d->br[grp][role];
871
\fn uint QPalette::resolve() const
876
\fn void QPalette::resolve(uint mask)
881
/*****************************************************************************
882
QPalette stream functions
883
*****************************************************************************/
885
#ifndef QT_NO_DATASTREAM
887
static const int NumOldRoles = 7;
888
static const int oldRoles[7] = { QPalette::Foreground, QPalette::Background, QPalette::Light,
889
QPalette::Dark, QPalette::Mid, QPalette::Text, QPalette::Base };
894
Writes the palette, \a p to the stream \a s and returns a
895
reference to the stream.
897
\sa \link datastreamformat.html Format of the QDataStream operators \endlink
900
QDataStream &operator<<(QDataStream &s, const QPalette &p)
902
for (int grp = 0; grp < (int)QPalette::NColorGroups; grp++) {
903
if (s.version() == 1) {
905
for (int i = 0; i < NumOldRoles; ++i)
906
s << p.d->br[grp][oldRoles[i]].color();
908
int max = QPalette::NColorRoles;
909
if (s.version() <= 3) // Qt 2.x
911
for (int r = 0; r < max; r++)
912
s << p.d->br[grp][r];
918
static void readV1ColorGroup(QDataStream &s, QPalette &pal, QPalette::ColorGroup grp)
920
for (int i = 0; i < NumOldRoles; ++i) {
923
pal.setColor(grp, (QPalette::ColorRole)oldRoles[i], col);
930
Reads a palette from the stream, \a s into the palette \a p, and
931
returns a reference to the stream.
933
\sa \link datastreamformat.html Format of the QDataStream operators \endlink
936
QDataStream &operator>>(QDataStream &s, QPalette &p)
938
if(s.version() == 1) {
940
readV1ColorGroup(s, p, QPalette::Active);
941
readV1ColorGroup(s, p, QPalette::Disabled);
942
readV1ColorGroup(s, p, QPalette::Inactive);
944
int max = QPalette::NColorRoles;
945
if (s.version() <= 3) { // Qt 2.x
951
for(int grp = 0; grp < (int)QPalette::NColorGroups; ++grp) {
952
for(int role = 0; role < max; ++role) {
954
p.setBrush((QPalette::ColorGroup)grp, (QPalette::ColorRole)role, tmp);
960
#endif //QT_NO_DATASTREAM
963
Returns true if this palette and \a p are copies of each other,
964
i.e. one of them was created as a copy of the other and neither
965
was subsequently modified; otherwise returns false. This is much
966
stricter than equality.
968
\sa operator=() operator==()
971
bool QPalette::isCopyOf(const QPalette &p) const
978
Sets a the group at \a cg. You can pass either brushes, pixmaps or
979
plain colors for \a foreground, \a button, \a light, \a dark, \a
980
mid, \a text, \a bright_text, \a base and \a background.
984
void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBrush &button,
985
const QBrush &light, const QBrush &dark, const QBrush &mid,
986
const QBrush &text, const QBrush &bright_text, const QBrush &base,
987
const QBrush &background)
989
QBrush mid_light = QBrush(qt_mix_colors(button.color(), light.color()));
990
setColorGroup(cg, foreground, button, light, dark, mid, text, bright_text, base,
991
mid_light, background, mid_light, text,
992
QBrush(Qt::black), QBrush(Qt::darkBlue), QBrush(Qt::white),
993
QBrush(Qt::blue), QBrush(Qt::magenta));
995
resolve_mask &= ~(1 << Highlight);
996
resolve_mask &= ~(1 << HighlightedText);
997
resolve_mask &= ~(1 << LinkVisited);
998
resolve_mask &= ~(1 << Link);
1004
QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBrush &button,
1005
const QBrush &light, const QBrush &dark, const QBrush &mid,
1006
const QBrush &text, const QBrush &bright_text,
1007
const QBrush &base, const QBrush &alternate_base,
1008
const QBrush &background, const QBrush &midlight,
1009
const QBrush &button_text, const QBrush &shadow,
1010
const QBrush &highlight, const QBrush &highlighted_text,
1011
const QBrush &link, const QBrush &link_visited)
1014
setBrush(cg, Foreground, foreground);
1015
setBrush(cg, Button, button);
1016
setBrush(cg, Light, light);
1017
setBrush(cg, Dark, dark);
1018
setBrush(cg, Mid, mid);
1019
setBrush(cg, Text, text);
1020
setBrush(cg, BrightText, bright_text);
1021
setBrush(cg, Base, base);
1022
setBrush(cg, AlternateBase, alternate_base);
1023
setBrush(cg, Background, background);
1024
setBrush(cg, Midlight, midlight);
1025
setBrush(cg, ButtonText, button_text);
1026
setBrush(cg, Shadow, shadow);
1027
setBrush(cg, Highlight, highlight);
1028
setBrush(cg, HighlightedText, highlighted_text);
1029
setBrush(cg, Link, link);
1030
setBrush(cg, LinkVisited, link_visited);
1034
\fn QPalette QPalette::copy() const
1036
Use simple assignment instead.
1040
\fn QColorGroup QPalette::normal() const
1042
Use createColorGroup(Active) instead.
1046
\fn void QPalette::setNormal(const QColorGroup &colorGroup)
1048
Use setColorGroup(Active, colorGroup) instead.
1052
\fn QColorGroup QPalette::active() const
1056
\fn QColorGroup QPalette::disabled() const
1060
\fn QColorGroup QPalette::inactive() const
1064
\fn void QPalette::setActive(const QColorGroup &colorGroup)
1066
Use setColorGroup(Active, colorGroup) instead.
1070
\fn void QPalette::setDisabled(const QColorGroup &colorGroup)
1072
Use setColorGroup(Disabled, colorGroup) instead.
1076
\fn void QPalette::setInactive(const QColorGroup &colorGroup)
1078
Use setColorGroup(Inactive, colorGroup) instead.
1081
/*! \class QColorGroup
1085
/*! \fn QColorGroup::QColorGroup()
1087
Use QPalette() instead.
1090
/*! \fn QColorGroup::QColorGroup(const QBrush &foreground, const QBrush &button, \
1091
const QBrush &light, const QBrush &dark, const QBrush &mid, \
1092
const QBrush &text, const QBrush &bright_text,
1093
const QBrush &base, const QBrush &background)
1095
Use QPalette(\a foreground, \a button, \a light, \a dark, \a mid,
1096
\a text, \a bright_text, \a base, \a background) instead.
1099
/*! \fn QColorGroup::QColorGroup(const QColor &foreground, const QColor &background, \
1100
const QColor &light, const QColor &dark, const QColor &mid, \
1101
const QColor &text, const QColor &base)
1103
Use QColorGroup(\a foreground, \a background, \a light, \a dark,
1104
\a mid, \a text, \a base) instead.
1107
/*! \fn QColorGroup::QColorGroup(const QColorGroup &other)
1109
Use QPalette(\a other) instead.
1112
/*! \fn QColorGroup::QColorGroup(const QPalette &pal)
1114
Use QPalette(\a pal) instead.
1117
/*! \fn const QColor &QColorGroup::foreground() const
1119
Use QPalette::foreground().color() instead.
1122
/*! \fn const QColor &QColorGroup::button() const
1124
Use QPalette::button().color() instead.
1127
/*! \fn const QColor &QColorGroup::light() const
1129
Use QPalette::light().color() instead.
1132
/*! \fn const QColor &QColorGroup::dark() const
1134
Use QPalette::dark().color() instead.
1137
/*! \fn const QColor &QColorGroup::mid() const
1139
Use QPalette::mid().color() instead.
1142
/*! \fn const QColor &QColorGroup::text() const
1144
Use QPalette::text().color() instead.
1147
/*! \fn const QColor &QColorGroup::base() const
1149
Use QPalette::base().color() instead.
1152
/*! \fn const QColor &QColorGroup::background() const
1154
Use QPalette::background().color() instead.
1157
/*! \fn const QColor &QColorGroup::midlight() const
1159
Use QPalette::midlight().color() instead.
1162
/*! \fn const QColor &QColorGroup::brightText() const
1164
Use QPalette::brightText().color() instead.
1167
/*! \fn const QColor &QColorGroup::buttonText() const
1169
Use QPalette::buttonText().color() instead.
1172
/*! \fn const QColor &QColorGroup::shadow() const
1174
Use QPalette::shadow().color() instead.
1177
/*! \fn const QColor &QColorGroup::highlight() const
1179
Use QPalette::highlight().color() instead.
1182
/*! \fn const QColor &QColorGroup::highlightedText() const
1184
Use QPalette::highlightedText().color() instead.
1187
/*! \fn const QColor &QColorGroup::link() const
1189
Use QPalette::link().color() instead.
1192
/*! \fn const QColor &QColorGroup::linkVisited() const
1194
Use QPalette::linkVisited().color() instead.
1197
/*! \fn QDataStream &operator<<(QDataStream &ds, const QColorGroup &colorGroup)
1198
\relates QColorGroup
1202
/*! \fn QDataStream &operator>>(QDataStream &ds, QColorGroup &colorGroup)
1203
\relates QColorGroup
1207
/*! \fn bool QColorGroup::operator==(const QColorGroup &other) const
1209
Returns true if this color group is equal to \a other; otherwise
1213
/*! \fn bool QColorGroup::operator!=(const QColorGroup &other) const
1215
Returns true if this color group is not equal to \a other;
1216
otherwise returns false.
1219
#endif // QT_NO_PALETTE