Qt 4.8
qpalette.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qpalette.h"
43 #include "qapplication.h"
44 #include "qdatastream.h"
45 #include "qvariant.h"
46 
48 
49 static int qt_palette_count = 1;
50 
52 public:
56  int ser_no;
57  int detach_no;
58 };
59 
61 {
62  return QColor((a.red() + b.red()) / 2, (a.green() + b.green()) / 2,
63  (a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2);
64 }
65 
66 #ifdef QT3_SUPPORT
67 
68 #ifndef QT_NO_DATASTREAM
69 QDataStream &qt_stream_out_qcolorgroup(QDataStream &s, const QColorGroup &g)
70 {
71  if(s.version() == 1) {
72  // Qt 1.x
73  s << g.color(QPalette::Foreground) << g.color(QPalette::Background)
74  << g.color(QPalette::Light) << g.color(QPalette::Dark)
75  << g.color(QPalette::Mid) << g.color(QPalette::Text) << g.color(QPalette::Base);
76  } else {
77  int max = QPalette::NColorRoles;
78  if (s.version() <= QDataStream::Qt_2_1)
79  max = QPalette::HighlightedText + 1;
80  else if (s.version() <= QDataStream::Qt_4_3)
81  max = QPalette::AlternateBase + 1;
82  for(int r = 0 ; r < max ; r++)
83  s << g.brush((QPalette::ColorRole)r);
84  }
85  return s;
86 }
87 
88 QDataStream &qt_stream_in_qcolorgroup(QDataStream &s, QColorGroup &g)
89 {
90  if(s.version() == 1) { // Qt 1.x
91  QColor fg, bg, light, dark, mid, text, base;
92  s >> fg >> bg >> light >> dark >> mid >> text >> base;
93  QPalette p(bg);
100  g = p;
101  g.setCurrentColorGroup(QPalette::Active);
102  } else {
103  int max = QPalette::NColorRoles;
104  if (s.version() <= QDataStream::Qt_2_1)
105  max = QPalette::HighlightedText + 1;
106  else if (s.version() <= QDataStream::Qt_3_0)
107  max = QPalette::LinkVisited + 1;
108  else if (s.version() <= QDataStream::Qt_4_3)
109  max = QPalette::AlternateBase + 1;
110  QBrush tmp;
111  for(int r = 0 ; r < max; r++) {
112  s >> tmp;
113  g.setBrush((QPalette::ColorRole)r, tmp);
114  }
115  }
116  return s;
117 }
118 
120 {
121  return qt_stream_out_qcolorgroup(s, g);
122 }
123 
125 {
126  return qt_stream_in_qcolorgroup(s, g);
127 }
128 #endif // QT_NO_DATASTREAM
129 
134 QPalette::QPalette(const QColorGroup &active, const QColorGroup &disabled,
135  const QColorGroup &inactive)
136 {
138  init();
139  setColorGroup(Active, active);
140  setColorGroup(Disabled, disabled);
141  setColorGroup(Inactive, inactive);
142 }
143 
144 QColorGroup QPalette::createColorGroup(ColorGroup cr) const
145 {
146  QColorGroup ret(*this);
147  ret.setCurrentColorGroup(cr);
148  return ret;
149 }
150 
151 void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g)
152 {
153  setColorGroup(cg, g.brush(WindowText), g.brush(Button), g.brush(Light),
154  g.brush(Dark), g.brush(Mid), g.brush(Text), g.brush(BrightText),
155  g.brush(Base), g.brush(AlternateBase), g.brush(Window),
156  g.brush(Midlight), g.brush(ButtonText), g.brush(Shadow),
157  g.brush(Highlight), g.brush(HighlightedText), g.brush(Link),
158  g.brush(LinkVisited), g.brush(ToolTipBase), g.brush(ToolTipText));
159 }
160 
161 #endif // QT3_SUPPORT
162 
674  : d(QApplication::palette().d),
675  current_group(Active),
676  resolve_mask(0)
677 {
678  d->ref.ref();
679 }
680 
681 static void qt_palette_from_color(QPalette &pal, const QColor & button)
682 {
683  QColor bg = button,
684  btn = button,
685  fg, base;
686  int h, s, v;
687  bg.getHsv(&h, &s, &v);
688  if(v > 128) {
689  fg = Qt::black;
690  base = Qt::white;
691  } else {
692  fg = Qt::white;
693  base = Qt::black;
694  }
695  //inactive and active are the same..
696  pal.setColorGroup(QPalette::Active, QBrush(fg), QBrush(btn), QBrush(btn.lighter(150)),
697  QBrush(btn.darker()), QBrush(btn.darker(150)), QBrush(fg), QBrush(Qt::white),
698  QBrush(base), QBrush(bg));
699  pal.setColorGroup(QPalette::Inactive, QBrush(fg), QBrush(btn), QBrush(btn.lighter(150)),
700  QBrush(btn.darker()), QBrush(btn.darker(150)), QBrush(fg), QBrush(Qt::white),
701  QBrush(base), QBrush(bg));
702  pal.setColorGroup(QPalette::Disabled, QBrush(btn.darker()), QBrush(btn), QBrush(btn.lighter(150)),
703  QBrush(btn.darker()), QBrush(btn.darker(150)), QBrush(btn.darker()),
704  QBrush(Qt::white), QBrush(bg), QBrush(bg));
705 }
706 
707 
714 {
715  init();
716  qt_palette_from_color(*this, button);
717 }
718 
725 {
726  init();
727  qt_palette_from_color(*this, button);
728 }
729 
738  const QBrush &light, const QBrush &dark,
739  const QBrush &mid, const QBrush &text,
740  const QBrush &bright_text, const QBrush &base,
741  const QBrush &window)
742 {
743  init();
744  setColorGroup(All, windowText, button, light, dark, mid, text, bright_text,
745  base, window);
746 }
747 
748 
756  const QColor &light, const QColor &dark, const QColor &mid,
757  const QColor &text, const QColor &base)
758 {
759  init();
760  setColorGroup(All, QBrush(windowText), QBrush(window), QBrush(light),
761  QBrush(dark), QBrush(mid), QBrush(text), QBrush(light),
762  QBrush(base), QBrush(window));
763 }
764 
771 {
772  init();
773  QColor bg = window, btn = button, fg, base, disfg;
774  int h, s, v;
775  bg.getHsv(&h, &s, &v);
776  if(v > 128) {
777  fg = Qt::black;
778  base = Qt::white;
779  disfg = Qt::darkGray;
780  } else {
781  fg = Qt::white;
782  base = Qt::black;
783  disfg = Qt::darkGray;
784  }
785  //inactive and active are identical
786  setColorGroup(Inactive, QBrush(fg), QBrush(btn), QBrush(btn.lighter(150)), QBrush(btn.darker()),
787  QBrush(btn.darker(150)), QBrush(fg), QBrush(Qt::white), QBrush(base),
788  QBrush(bg));
789  setColorGroup(Active, QBrush(fg), QBrush(btn), QBrush(btn.lighter(150)), QBrush(btn.darker()),
790  QBrush(btn.darker(150)), QBrush(fg), QBrush(Qt::white), QBrush(base),
791  QBrush(bg));
792  setColorGroup(Disabled, QBrush(disfg), QBrush(btn), QBrush(btn.lighter(150)),
793  QBrush(btn.darker()), QBrush(btn.darker(150)), QBrush(disfg),
794  QBrush(Qt::white), QBrush(base), QBrush(bg));
795 }
796 
803 {
804  d = p.d;
805  d->ref.ref();
808 }
809 
814 {
815  if(!d->ref.deref())
816  delete d;
817 }
818 
821  d = new QPalettePrivate;
822  resolve_mask = 0;
823  current_group = Active; //as a default..
824 }
825 
833 {
834  p.d->ref.ref();
837  if(!d->ref.deref())
838  delete d;
839  d = p.d;
840  return *this;
841 }
842 
846 QPalette::operator QVariant() const
847 {
848  return QVariant(QVariant::Palette, this);
849 }
850 
875 {
876  Q_ASSERT(cr < NColorRoles);
877  if(gr >= (int)NColorGroups) {
878  if(gr == Current) {
880  } else {
881  qWarning("QPalette::brush: Unknown ColorGroup: %d", (int)gr);
882  gr = Active;
883  }
884  }
885  return d->br[gr][cr];
886 }
887 
913 {
914  Q_ASSERT(cr < NColorRoles);
915  detach();
916  if(cg >= (int)NColorGroups) {
917  if(cg == All) {
918  for(int i = 0; i < (int)NColorGroups; i++)
919  d->br[i][cr] = b;
920  resolve_mask |= (1<<cr);
921  return;
922  } else if(cg == Current) {
924  } else {
925  qWarning("QPalette::setBrush: Unknown ColorGroup: %d", (int)cg);
926  cg = Active;
927  }
928  }
929  d->br[cg][cr] = b;
930  resolve_mask |= (1<<cr);
931 }
932 
945 {
946  Q_UNUSED(cg);
947  return (resolve_mask & (1<<cr));
948 }
949 
954 {
955  if (d->ref != 1) {
957  for(int grp = 0; grp < (int)NColorGroups; grp++) {
958  for(int role = 0; role < (int)NColorRoles; role++)
959  x->br[grp][role] = d->br[grp][role];
960  }
961  if(!d->ref.deref())
962  delete d;
963  d = x;
964  }
965  ++d->detach_no;
966 }
967 
992 bool QPalette::operator==(const QPalette &p) const
993 {
994  if (isCopyOf(p))
995  return true;
996  for(int grp = 0; grp < (int)NColorGroups; grp++) {
997  for(int role = 0; role < (int)NColorRoles; role++) {
998  if(d->br[grp][role] != p.d->br[grp][role])
999  return false;
1000  }
1001  }
1002  return true;
1003 }
1004 
1005 #ifdef QT3_SUPPORT
1006 bool QColorGroup::operator==(const QColorGroup &other) const
1007 {
1008  if (isCopyOf(other))
1009  return true;
1010  for (int role = 0; role < int(NColorRoles); role++) {
1011  if(d->br[current_group][role] != other.d->br[other.current_group][role])
1012  return false;
1013  }
1014  return true;
1015 }
1016 
1020 QColorGroup::operator QVariant() const
1021 {
1022  return QVariant(QVariant::ColorGroup, this);
1023 }
1024 #endif
1025 
1036 {
1037  if(group1 >= (int)NColorGroups) {
1038  if(group1 == Current) {
1039  group1 = (ColorGroup)current_group;
1040  } else {
1041  qWarning("QPalette::brush: Unknown ColorGroup(1): %d", (int)group1);
1042  group1 = Active;
1043  }
1044  }
1045  if(group2 >= (int)NColorGroups) {
1046  if(group2 == Current) {
1047  group2 = (ColorGroup)current_group;
1048  } else {
1049  qWarning("QPalette::brush: Unknown ColorGroup(2): %d", (int)group2);
1050  group2 = Active;
1051  }
1052  }
1053  if(group1 == group2)
1054  return true;
1055  for(int role = 0; role < (int)NColorRoles; role++) {
1056  if(d->br[group1][role] != d->br[group2][role])
1057  return false;
1058  }
1059  return true;
1060 }
1061 
1082 {
1083  return d->ser_no;
1084 }
1085 
1094 {
1095  return (((qint64) d->ser_no) << 32) | ((qint64) (d->detach_no));
1096 }
1097 
1102 {
1103  if ((*this == other && resolve_mask == other.resolve_mask)
1104  || resolve_mask == 0) {
1105  QPalette o = other;
1107  return o;
1108  }
1109 
1110  QPalette palette(*this);
1111  palette.detach();
1112 
1113  for(int role = 0; role < (int)NColorRoles; role++)
1114  if (!(resolve_mask & (1<<role)))
1115  for(int grp = 0; grp < (int)NColorGroups; grp++)
1116  palette.d->br[grp][role] = other.d->br[grp][role];
1117 
1118  return palette;
1119 }
1120 
1132 /*****************************************************************************
1133  QPalette stream functions
1134  *****************************************************************************/
1135 
1136 #ifndef QT_NO_DATASTREAM
1137 
1138 static const int NumOldRoles = 7;
1141 
1155 {
1156  for (int grp = 0; grp < (int)QPalette::NColorGroups; grp++) {
1157  if (s.version() == 1) {
1158  // Qt 1.x
1159  for (int i = 0; i < NumOldRoles; ++i)
1160  s << p.d->br[grp][oldRoles[i]].color();
1161  } else {
1162  int max = QPalette::ToolTipText + 1;
1163  if (s.version() <= QDataStream::Qt_2_1)
1164  max = QPalette::HighlightedText + 1;
1165  else if (s.version() <= QDataStream::Qt_4_3)
1166  max = QPalette::AlternateBase + 1;
1167  for (int r = 0; r < max; r++)
1168  s << p.d->br[grp][r];
1169  }
1170  }
1171  return s;
1172 }
1173 
1175 {
1176  for (int i = 0; i < NumOldRoles; ++i) {
1177  QColor col;
1178  s >> col;
1179  pal.setColor(grp, (QPalette::ColorRole)oldRoles[i], col);
1180  }
1181 }
1182 
1196 {
1197  if(s.version() == 1) {
1198  p = QPalette();
1202  } else {
1203  int max = QPalette::NColorRoles;
1204  if (s.version() <= QDataStream::Qt_2_1) {
1205  p = QPalette();
1206  max = QPalette::HighlightedText + 1;
1207  } else if (s.version() <= QDataStream::Qt_4_3) {
1208  p = QPalette();
1209  max = QPalette::AlternateBase + 1;
1210  }
1211 
1212  QBrush tmp;
1213  for(int grp = 0; grp < (int)QPalette::NColorGroups; ++grp) {
1214  for(int role = 0; role < max; ++role) {
1215  s >> tmp;
1217  }
1218  }
1219  }
1220  return s;
1221 }
1222 #endif //QT_NO_DATASTREAM
1223 
1233 bool QPalette::isCopyOf(const QPalette &p) const
1234 {
1235  return d == p.d;
1236 }
1237 
1247  const QBrush &light, const QBrush &dark, const QBrush &mid,
1248  const QBrush &text, const QBrush &bright_text, const QBrush &base,
1249  const QBrush &window)
1250 {
1251  QBrush alt_base = QBrush(qt_mix_colors(base.color(), button.color()));
1252  QBrush mid_light = QBrush(qt_mix_colors(button.color(), light.color()));
1253  QColor toolTipBase(255, 255, 220);
1254  QColor toolTipText(0, 0, 0);
1255 
1256  setColorGroup(cg, windowText, button, light, dark, mid, text, bright_text, base,
1257  alt_base, window, mid_light, text,
1259  QBrush(Qt::blue), QBrush(Qt::magenta), QBrush(toolTipBase),
1260  QBrush(toolTipText));
1261 
1262  resolve_mask &= ~(1 << Highlight);
1263  resolve_mask &= ~(1 << HighlightedText);
1264  resolve_mask &= ~(1 << LinkVisited);
1265  resolve_mask &= ~(1 << Link);
1266 }
1267 
1268 
1270 void
1272  const QBrush &light, const QBrush &dark, const QBrush &mid,
1273  const QBrush &text, const QBrush &bright_text,
1274  const QBrush &base, const QBrush &alternate_base,
1275  const QBrush &background, const QBrush &midlight,
1276  const QBrush &button_text, const QBrush &shadow,
1277  const QBrush &highlight, const QBrush &highlighted_text,
1278  const QBrush &link, const QBrush &link_visited)
1279 {
1280  setColorGroup(cg, foreground, button, light, dark, mid,
1281  text, bright_text, base, alternate_base, background,
1282  midlight, button_text, shadow, highlight, highlighted_text,
1283  link, link_visited, background, foreground);
1284 }
1285 
1288  const QBrush &light, const QBrush &dark, const QBrush &mid,
1289  const QBrush &text, const QBrush &bright_text,
1290  const QBrush &base, const QBrush &alternate_base,
1291  const QBrush &background, const QBrush &midlight,
1292  const QBrush &button_text, const QBrush &shadow,
1293  const QBrush &highlight, const QBrush &highlighted_text,
1294  const QBrush &link, const QBrush &link_visited,
1295  const QBrush &toolTipBase, const QBrush &toolTipText)
1296 {
1297  detach();
1298  setBrush(cg, WindowText, foreground);
1299  setBrush(cg, Button, button);
1300  setBrush(cg, Light, light);
1301  setBrush(cg, Dark, dark);
1302  setBrush(cg, Mid, mid);
1303  setBrush(cg, Text, text);
1304  setBrush(cg, BrightText, bright_text);
1305  setBrush(cg, Base, base);
1306  setBrush(cg, AlternateBase, alternate_base);
1307  setBrush(cg, Window, background);
1308  setBrush(cg, Midlight, midlight);
1309  setBrush(cg, ButtonText, button_text);
1310  setBrush(cg, Shadow, shadow);
1311  setBrush(cg, Highlight, highlight);
1312  setBrush(cg, HighlightedText, highlighted_text);
1313  setBrush(cg, Link, link);
1314  setBrush(cg, LinkVisited, link_visited);
1315  setBrush(cg, ToolTipBase, toolTipBase);
1316  setBrush(cg, ToolTipText, toolTipText);
1317 }
1318 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
int serialNumber() const
Returns a number that identifies the contents of this QPalette object.
Definition: qpalette.cpp:1081
const QBrush & highlight() const
Returns the highlight brush of the current color group.
Definition: qpalette.h:140
The QApplication class manages the GUI application&#39;s control flow and main settings.
Definition: qapplication.h:99
const QBrush & base() const
Returns the base brush of the current color group.
Definition: qpalette.h:130
#define disabled
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
void init()
Definition: qpalette.cpp:820
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
Definition: qpalette.h:93
void detach()
Definition: qpalette.cpp:953
const QBrush & dark() const
Returns the dark brush of the current color group.
Definition: qpalette.h:127
static void qt_palette_from_color(QPalette &pal, const QColor &button)
Definition: qpalette.cpp:681
The QAtomicInt class provides platform-independent atomic operations on integers. ...
Definition: qatomic.h:55
static const int NumOldRoles
Definition: qpalette.cpp:1138
QPalettePrivate * d
Definition: qpalette.h:195
const QBrush & background() const
Use window() instead.
Definition: qpalette.h:134
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.
Definition: qpalette.cpp:1154
qint64 cacheKey() const
Returns a number that identifies the contents of this QPalette object.
Definition: qpalette.cpp:1093
const QBrush & foreground() const
Use windowText() instead.
Definition: qpalette.h:123
long ASN1_INTEGER_get ASN1_INTEGER * a
bool ref()
Atomically increments the value of this QAtomicInt.
QAtomicInt ref
Definition: qpalette.cpp:54
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static const uint base
Definition: qurl.cpp:268
static QColor qt_mix_colors(QColor a, QColor b)
Definition: qpalette.cpp:60
GlobalColor
Definition: qnamespace.h:104
void getHsv(int *h, int *s, int *v, int *a=0) const
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (tra...
Definition: qcolor.cpp:679
ColorGroup
Definition: qpalette.h:92
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
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...
Definition: qpalette.h:206
bool isCopyOf(const QPalette &p) const
Returns true if this palette and p are copies of each other, i.e.
Definition: qpalette.cpp:1233
const QBrush & light() const
Returns the light brush of the current color group.
Definition: qpalette.h:126
QPalette & operator=(const QPalette &palette)
Assigns p to this palette and returns a reference to this palette.
Definition: qpalette.cpp:832
static bool init
bool deref()
Atomically decrements the value of this QAtomicInt.
const QBrush & midlight() const
Returns the midlight brush of the current color group.
Definition: qpalette.h:136
const QBrush & mid() const
Returns the mid brush of the current color group.
Definition: qpalette.h:128
Q_CORE_EXPORT void qWarning(const char *,...)
uint current_group
Definition: qpalette.h:196
__int64 qint64
Definition: qglobal.h:942
static void readV1ColorGroup(QDataStream &s, QPalette &pal, QPalette::ColorGroup grp)
Definition: qpalette.cpp:1174
QBrush br[QPalette::NColorGroups][QPalette::NColorRoles]
Definition: qpalette.cpp:55
bool isEqual(ColorGroup cr1, ColorGroup cr2) const
Returns true (usually quickly) if color group cg1 is equal to cg2; otherwise returns false...
Definition: qpalette.cpp:1035
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition: qpalette.cpp:874
void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button, const QBrush &light, const QBrush &dark, const QBrush &mid, const QBrush &text, const QBrush &bright_text, const QBrush &base, const QBrush &window)
Sets a the group at cg.
Definition: qpalette.cpp:1246
int version() const
Returns the version number of the data serialization format.
Definition: qdatastream.h:212
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
const QBrush & shadow() const
Returns the shadow brush of the current color group.
Definition: qpalette.h:139
const QBrush & windowText() const
Returns the window text (general foreground) brush of the current color group.
Definition: qpalette.h:124
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
static int qt_palette_count
Definition: qpalette.cpp:49
ushort alpha
Returns the alpha color component of this color.
Definition: qcolor.h:242
bool isBrushSet(ColorGroup cg, ColorRole cr) const
Returns true if the ColorGroup cg and ColorRole cr has been set previously on this palette; otherwise...
Definition: qpalette.cpp:944
QDataStream & operator>>(QDataStream &s, QAxBase &c)
Definition: qaxbase.h:189
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...
Definition: qpalette.h:201
const QBrush & toolTipBase() const
Returns the tool tip base brush of the current color group.
Definition: qpalette.h:132
The QColorGroup class contains color groups for each widget state.
uint resolve() const
Definition: qpalette.h:166
const QBrush & toolTipText() const
Returns the tool tip text brush of the current color group.
Definition: qpalette.h:133
QDataStream & operator<<(QDataStream &s, const QAxBase &c)
Definition: qaxbase.h:203
const QBrush & link() const
Returns the unvisited link text brush of the current color group.
Definition: qpalette.h:142
bool operator==(const QPalette &p) const
Returns true (usually quickly) if this palette is equal to p; otherwise returns false (slowly)...
Definition: qpalette.cpp:992
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
QPalette()
Constructs a palette object that uses the application&#39;s default palette.
Definition: qpalette.cpp:673
QDataStream & operator>>(QDataStream &s, QPalette &p)
Reads a palette from the stream, s into the palette p, and returns a reference to the stream...
Definition: qpalette.cpp:1195
~QPalette()
Destroys the palette.
Definition: qpalette.cpp:813
const QBrush & button() const
Returns the button brush of the current color group.
Definition: qpalette.h:125
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244
bool operator==(QBool b1, bool b2)
Definition: qglobal.h:2023
const QBrush & window() const
Returns the window (general background) brush of the current color group.
Definition: qpalette.h:135
static const int oldRoles[7]
Definition: qpalette.cpp:1139
uint resolve_mask
Definition: qpalette.h:197
#define text
Definition: qobjectdefs.h:80
const QBrush & text() const
Returns the text foreground brush of the current color group.
Definition: qpalette.h:129
The Text item allows you to add formatted text to a scene.
Button
Definition: qmessagebox.cpp:82
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61