Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpalette.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qpalette_p.h"
5#include "qguiapplication_p.h"
6#include "qdatastream.h"
7#include "qvariant.h"
8#include "qdebug.h"
9
10#include <QtCore/qmetaobject.h>
11
13
16 < sizeof(QPalette::ResolveMask) * CHAR_BIT,
17 "The resolve mask type is not wide enough to fit the entire bit mask.");
18
20{
21 return QColor((a.red() + b.red()) / 2, (a.green() + b.green()) / 2,
22 (a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2);
23}
24
35static void qt_placeholder_from_text(QPalette &pal, int alpha = 50)
36{
37 if (alpha < 0 or alpha > 100)
38 return;
39
40 for (int cg = 0; cg < int(QPalette::NColorGroups); ++cg) {
42
43 // skip if the brush has been set already
46 const int a = (c.alpha() * alpha) / 100;
47 c.setAlpha(a);
49 }
50 }
51}
52
54{
55 // have a lighter/darker factor handy, depending on dark/light heuristics
56 const int lighter = pal.base().color().lightness() > pal.text().color().lightness() ? 130 : 70;
57
58 // Act only for color groups where no accent color is set
59 for (int i = 0; i < QPalette::NColorGroups; ++i) {
62 // Default to highlight if available, otherwise use a shade of base
63 const QBrush accentBrush = pal.isBrushSet(group, QPalette::Highlight)
65 : pal.brush(group, QPalette::Base).color().lighter(lighter);
66 pal.setBrush(group, QPalette::Accent, accentBrush);
67 }
68 }
69}
70
72{
73 int h, s, v;
74 button.getHsv(&h, &s, &v);
75 // inactive and active are the same..
76 const QBrush whiteBrush = QBrush(Qt::white);
77 const QBrush blackBrush = QBrush(Qt::black);
78 const QBrush baseBrush = v > 128 ? whiteBrush : blackBrush;
79 const QBrush foregroundBrush = v > 128 ? blackBrush : whiteBrush;
80 const QBrush buttonBrush = QBrush(button);
81 const QBrush buttonBrushDark = QBrush(button.darker());
82 const QBrush buttonBrushDark150 = QBrush(button.darker(150));
83 const QBrush buttonBrushLight150 = QBrush(button.lighter(150));
84 pal.setColorGroup(QPalette::Active, foregroundBrush, buttonBrush, buttonBrushLight150,
85 buttonBrushDark, buttonBrushDark150, foregroundBrush, whiteBrush,
86 baseBrush, buttonBrush);
87 pal.setColorGroup(QPalette::Inactive, foregroundBrush, buttonBrush, buttonBrushLight150,
88 buttonBrushDark, buttonBrushDark150, foregroundBrush, whiteBrush,
89 baseBrush, buttonBrush);
90 pal.setColorGroup(QPalette::Disabled, buttonBrushDark, buttonBrush, buttonBrushLight150,
91 buttonBrushDark, buttonBrushDark150, buttonBrushDark,
92 whiteBrush, buttonBrush, buttonBrush);
93
96}
97
545 : d(nullptr)
546{
547 // Initialize to application palette if present, else default to black.
548 // This makes it possible to instantiate QPalette outside QGuiApplication,
549 // for example in the platform plugins.
552 d->ref.ref();
554 } else {
555 init();
557 d->resolveMask = 0;
558 }
559}
560
567{
568 init();
570}
571
582
590QPalette::QPalette(const QBrush &windowText, const QBrush &button,
591 const QBrush &light, const QBrush &dark,
592 const QBrush &mid, const QBrush &text,
593 const QBrush &bright_text, const QBrush &base,
594 const QBrush &window)
595{
596 init();
597 setColorGroup(All, windowText, button, light, dark, mid, text, bright_text,
598 base, window);
599
602}
603
604
612QPalette::QPalette(const QColor &windowText, const QColor &window,
613 const QColor &light, const QColor &dark, const QColor &mid,
614 const QColor &text, const QColor &base)
615{
616 init();
617 const QBrush windowBrush(window);
618 const QBrush lightBrush(light);
619 setColorGroup(All, QBrush(windowText), windowBrush, lightBrush,
620 QBrush(dark), QBrush(mid), QBrush(text), lightBrush,
621 QBrush(base), windowBrush);
622}
623
630{
631 init();
632 int h, s, v;
633 window.getHsv(&h, &s, &v);
634
635 const QBrush windowBrush = QBrush(window);
636 const QBrush whiteBrush = QBrush(Qt::white);
637 const QBrush blackBrush = QBrush(Qt::black);
638 const QBrush baseBrush = v > 128 ? whiteBrush : blackBrush;
639 const QBrush foregroundBrush = v > 128 ? blackBrush : whiteBrush;
640 const QBrush disabledForeground = QBrush(Qt::darkGray);
641
642 const QBrush buttonBrush = QBrush(button);
643 const QBrush buttonBrushDark = QBrush(button.darker());
644 const QBrush buttonBrushDark150 = QBrush(button.darker(150));
645 const QBrush buttonBrushLight150 = QBrush(button.lighter(150));
646
647 //inactive and active are identical
648 setColorGroup(Inactive, foregroundBrush, buttonBrush, buttonBrushLight150, buttonBrushDark,
649 buttonBrushDark150, foregroundBrush, whiteBrush, baseBrush,
650 windowBrush);
651 setColorGroup(Active, foregroundBrush, buttonBrush, buttonBrushLight150, buttonBrushDark,
652 buttonBrushDark150, foregroundBrush, whiteBrush, baseBrush,
653 windowBrush);
654 setColorGroup(Disabled, disabledForeground, buttonBrush, buttonBrushLight150,
655 buttonBrushDark, buttonBrushDark150, disabledForeground,
656 whiteBrush, baseBrush, windowBrush);
657
660}
661
668 : d(p.d), currentGroup(p.currentGroup)
669{
670 d->ref.ref();
671}
672
688{
689 if (d && !d->ref.deref())
690 delete d;
691}
692
694void QPalette::init()
695{
696 d = new QPalettePrivate;
697}
698
706{
707 p.d->ref.ref();
708 currentGroup = p.currentGroup;
709 if (d && !d->ref.deref())
710 delete d;
711 d = p.d;
712 return *this;
713}
714
726QPalette::operator QVariant() const
727{
728 return QVariant::fromValue(*this);
729}
730
749{
750 Q_ASSERT(cr < NColorRoles);
751 if (gr >= (int)NColorGroups) {
752 if (gr == Current) {
753 gr = currentGroup;
754 } else {
755 qWarning("QPalette::brush: Unknown ColorGroup: %d", (int)gr);
756 gr = Active;
757 }
758 }
759 return d->data->br[gr][cr];
760}
761
781{
782 Q_ASSERT(cr < NColorRoles);
783
784 if (cg == All) {
785 for (uint i = 0; i < NColorGroups; i++)
786 setBrush(ColorGroup(i), cr, b);
787 return;
788 }
789
790 if (cg == Current) {
791 cg = currentGroup;
792 } else if (cg >= NColorGroups) {
793 qWarning("QPalette::setBrush: Unknown ColorGroup: %d", cg);
794 cg = Active;
795 }
796
797 const auto newResolveMask = d->resolveMask | ResolveMask(1) << QPalettePrivate::bitPosition(cg, cr);
798 const auto valueChanged = d->data->br[cg][cr] != b;
799
800 if (valueChanged) {
801 detach();
802 d->data.detach();
803 d->data->br[cg][cr] = b;
804 } else if (d->resolveMask != newResolveMask) {
805 detach();
806 }
807
808 d->resolveMask = newResolveMask;
809}
810
826{
827 // NoRole has no resolve mask and should never be set anyway
828 if (cr == NoRole)
829 return false;
830
831 if (cg == Current)
832 cg = currentGroup;
833
834 if (cg >= NColorGroups) {
835 qWarning() << "Wrong color group:" << cg;
836 return false;
837 }
838
839 if (cr >= NColorRoles) {
840 qWarning() << "Wrong color role:" << cr;
841 return false;
842 }
843
844 return d->resolveMask & (ResolveMask(1) << QPalettePrivate::bitPosition(cg, cr));
845}
846
850void QPalette::detach()
851{
852 if (d->ref.loadRelaxed() != 1) {
854 x->resolveMask = d->resolveMask;
855 if (!d->ref.deref())
856 delete d;
857 d = x;
858 } else {
860 }
861}
862
888{
889 if (isCopyOf(p) || d->data == p.d->data)
890 return true;
891 for(int grp = 0; grp < (int)NColorGroups; grp++) {
892 for(int role = 0; role < (int)NColorRoles; role++) {
893 // Dont't verify NoRole, because it has no resolve bit
894 if (role == NoRole)
895 continue;
896 if (d->data->br[grp][role] != p.d->data->br[grp][role])
897 return false;
898 }
899 }
900 return true;
901}
902
910{
911 if (group1 >= (int)NColorGroups) {
912 if (group1 == Current) {
913 group1 = currentGroup;
914 } else {
915 qWarning("QPalette::brush: Unknown ColorGroup(1): %d", (int)group1);
916 group1 = Active;
917 }
918 }
919 if (group2 >= (int)NColorGroups) {
920 if (group2 == Current) {
921 group2 = currentGroup;
922 } else {
923 qWarning("QPalette::brush: Unknown ColorGroup(2): %d", (int)group2);
924 group2 = Active;
925 }
926 }
927 if (group1 == group2)
928 return true;
929 for(int role = 0; role < (int)NColorRoles; role++) {
930 if (d->data->br[group1][role] != d->data->br[group2][role])
931 return false;
932 }
933 return true;
934}
935
944{
945 return (((qint64) d->data->ser_no) << 32) | ((qint64) (d->detach_no));
946}
947
949{
951 for (int role = 0; role < int(QPalette::NColorRoles); ++role) {
952 for (int grp = 0; grp < int(QPalette::NColorGroups); ++grp) {
954 }
955 }
956 return mask;
957}
958
964{
965 if ((*this == other && d->resolveMask == other.d->resolveMask)
966 || d->resolveMask == 0) {
967 QPalette o = other;
968 o.setResolveMask(d->resolveMask);
969 return o;
970 }
971
972 if (d->resolveMask == allResolveMask())
973 return *this;
974
975 QPalette palette(*this);
976 palette.detach();
977
978 for (int role = 0; role < int(NColorRoles); ++role) {
979 // Don't resolve NoRole, its bits are needed for Accent (see bitPosition)
980 if (role == NoRole)
981 continue;
982
983 for (int grp = 0; grp < int(NColorGroups); ++grp) {
985 palette.d->data.detach();
986 palette.d->data->br[grp][role] = other.d->data->br[grp][role];
987 }
988 }
989 }
990
991 palette.d->resolveMask |= other.d->resolveMask;
992
993 return palette;
994}
995
1000{
1001 return d->resolveMask;
1002}
1003
1008{
1009 if (mask == d->resolveMask)
1010 return;
1011
1012 detach();
1013 d->resolveMask = mask;
1014}
1015
1024/*****************************************************************************
1025 QPalette stream functions
1026 *****************************************************************************/
1027
1028#ifndef QT_NO_DATASTREAM
1029
1030static const int NumOldRoles = 7;
1033
1044{
1045 for (int grp = 0; grp < (int)QPalette::NColorGroups; grp++) {
1046 if (s.version() == 1) {
1047 // Qt 1.x
1048 for (int i = 0; i < NumOldRoles; ++i)
1049 s << p.d->data->br[grp][oldRoles[i]].color();
1050 } else {
1051 int max = (int)QPalette::NColorRoles;
1052 if (s.version() <= QDataStream::Qt_2_1)
1053 max = QPalette::HighlightedText + 1;
1054 else if (s.version() <= QDataStream::Qt_4_3)
1055 max = QPalette::AlternateBase + 1;
1056 else if (s.version() <= QDataStream::Qt_5_11)
1057 max = QPalette::ToolTipText + 1;
1058 else if (s.version() <= QDataStream::Qt_6_5)
1059 max = QPalette::PlaceholderText + 1;
1060
1061 for (int r = 0; r < max; r++)
1062 s << p.d->data->br[grp][r];
1063 }
1064 }
1065 return s;
1066}
1067
1069{
1070 for (int i = 0; i < NumOldRoles; ++i) {
1071 QColor col;
1072 s >> col;
1073 pal.setColor(grp, (QPalette::ColorRole)oldRoles[i], col);
1074 }
1075}
1076
1087{
1088 if (s.version() == 1) {
1089 p = QPalette();
1093 } else {
1094 int max = QPalette::NColorRoles;
1095 if (s.version() <= QDataStream::Qt_2_1) {
1096 p = QPalette();
1097 max = QPalette::HighlightedText + 1;
1098 } else if (s.version() <= QDataStream::Qt_4_3) {
1099 p = QPalette();
1100 max = QPalette::AlternateBase + 1;
1101 } else if (s.version() <= QDataStream::Qt_5_11) {
1102 p = QPalette();
1103 max = QPalette::ToolTipText + 1;
1104 } else if (s.version() <= QDataStream::Qt_6_5) {
1105 p = QPalette();
1106 max = QPalette::PlaceholderText + 1;
1107 }
1108
1109
1110 QBrush tmp;
1111 for(int grp = 0; grp < (int)QPalette::NColorGroups; ++grp) {
1112 const QPalette::ColorGroup group = static_cast<QPalette::ColorGroup>(grp);
1113 for(int role = 0; role < max; ++role) {
1114 s >> tmp;
1115 p.setBrush(group, (QPalette::ColorRole)role, tmp);
1116 }
1117
1118 // Accent defaults to Highlight for stream versions that don't have it.
1119 if (s.version() < QDataStream::Qt_6_6)
1120 p.setBrush(group, QPalette::Accent, p.brush(group, QPalette::Highlight));
1121 }
1122
1123 }
1124 return s;
1125}
1126#endif //QT_NO_DATASTREAM
1127
1138{
1139 return d == p.d;
1140}
1141
1150void QPalette::setColorGroup(ColorGroup cg, const QBrush &windowText, const QBrush &button,
1151 const QBrush &light, const QBrush &dark, const QBrush &mid,
1152 const QBrush &text, const QBrush &bright_text, const QBrush &base,
1153 const QBrush &window)
1154{
1155 QBrush alt_base = QBrush(qt_mix_colors(base.color(), button.color()));
1156 QBrush mid_light = QBrush(qt_mix_colors(button.color(), light.color()));
1157 QColor toolTipBase(255, 255, 220);
1158 QColor toolTipText(0, 0, 0);
1159
1160 setColorGroup(cg, windowText, button, light, dark, mid, text, bright_text, base,
1161 alt_base, window, mid_light, text,
1165
1166 for (int cr = Highlight; cr <= LinkVisited; ++cr) {
1167 if (cg == All) {
1168 for (int group = Active; group < NColorGroups; ++group) {
1170 }
1171 } else {
1173 }
1174 }
1175}
1176
1177
1179void
1180QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBrush &button,
1181 const QBrush &light, const QBrush &dark, const QBrush &mid,
1182 const QBrush &text, const QBrush &bright_text,
1183 const QBrush &base, const QBrush &alternate_base,
1184 const QBrush &background, const QBrush &midlight,
1185 const QBrush &button_text, const QBrush &shadow,
1186 const QBrush &highlight, const QBrush &highlighted_text,
1187 const QBrush &link, const QBrush &link_visited)
1188{
1189 setColorGroup(cg, foreground, button, light, dark, mid,
1190 text, bright_text, base, alternate_base, background,
1191 midlight, button_text, shadow, highlight, highlighted_text,
1192 link, link_visited, background, foreground);
1193}
1194
1196void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBrush &button,
1197 const QBrush &light, const QBrush &dark, const QBrush &mid,
1198 const QBrush &text, const QBrush &bright_text,
1199 const QBrush &base, const QBrush &alternate_base,
1200 const QBrush &background, const QBrush &midlight,
1201 const QBrush &button_text, const QBrush &shadow,
1202 const QBrush &highlight, const QBrush &highlighted_text,
1203 const QBrush &link, const QBrush &link_visited,
1204 const QBrush &toolTipBase, const QBrush &toolTipText)
1205{
1206 setBrush(cg, WindowText, foreground);
1207 setBrush(cg, Button, button);
1208 setBrush(cg, Light, light);
1209 setBrush(cg, Dark, dark);
1210 setBrush(cg, Mid, mid);
1211 setBrush(cg, Text, text);
1212 setBrush(cg, BrightText, bright_text);
1213 setBrush(cg, Base, base);
1214 setBrush(cg, AlternateBase, alternate_base);
1215 setBrush(cg, Window, background);
1217 setBrush(cg, ButtonText, button_text);
1218 setBrush(cg, Shadow, shadow);
1220 setBrush(cg, HighlightedText, highlighted_text);
1221 setBrush(cg, Link, link);
1222 setBrush(cg, LinkVisited, link_visited);
1225}
1226
1227#ifndef QT_NO_DEBUG_STREAM
1229{
1230 const auto groupEnum = QMetaEnum::fromType<QPalette::ColorGroup>();
1231
1233 for (int group = 0; group < QPalette::NColorGroups; ++group) {
1234 const auto cg = QPalette::ColorGroup(group);
1235
1236 if (p.isBrushSet(cg, cr)) {
1237 const auto &color = p.color(cg, cr);
1238 groupString += QString::fromUtf8(groupEnum.valueToKey(cg)) + u':' +
1239 color.name(QColor::HexArgb) + u',';
1240 }
1241 }
1242 groupString.chop(1);
1243
1244 return groupString;
1245}
1246
1248{
1249 const auto roleEnum = QMetaEnum::fromType<QPalette::ColorRole>();
1250
1251 QString roleString;
1252 for (int role = 0; role < QPalette::NColorRoles; ++role) {
1253 const auto cr = QPalette::ColorRole(role);
1254
1255 auto groupString = groupsToString(p, cr);
1256 if (!groupString.isEmpty())
1257 roleString += QString::fromUtf8(roleEnum.valueToKey(cr)) + QStringLiteral(":[") +
1259 }
1260 roleString.chop(1);
1261
1262 return roleString;
1263}
1264
1266{
1267 QDebugStateSaver saver(dbg);
1268 dbg.nospace();
1269
1270 dbg << "QPalette(resolve=" << Qt::hex << Qt::showbase << p.resolveMask();
1271
1272 auto roleString = rolesToString(p);
1273 if (!roleString.isEmpty())
1274 dbg << ',' << roleString;
1275
1276 dbg << ')';
1277
1278 return dbg;
1279 }
1280#endif
1281
1283
1284#include "moc_qpalette.cpp"
bool ref() noexcept
bool deref() noexcept
T loadRelaxed() const noexcept
\inmodule QtGui
Definition qbrush.h:30
const QColor & color() const
Returns the brush color.
Definition qbrush.h:121
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
int lightness() const noexcept
Definition qcolor.cpp:1860
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
Definition qcolor.cpp:1481
QColor lighter(int f=150) const noexcept
Definition qcolor.cpp:2812
@ HexArgb
Definition qcolor.h:36
\inmodule QtCore\reentrant
Definition qdatastream.h:46
\inmodule QtCore
\inmodule QtCore
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
static QPalette * app_pal
static constexpr QPalette::ResolveMask bitPosition(QPalette::ColorGroup colorGroup, QPalette::ColorRole colorRole)
Definition qpalette_p.h:57
static int qt_palette_private_count
Definition qpalette_p.h:70
QPalette::ResolveMask resolveMask
Definition qpalette_p.h:68
QExplicitlySharedDataPointer< Data > data
Definition qpalette_p.h:72
QAtomicInt ref
Definition qpalette_p.h:67
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
const QBrush & highlight() const
Returns the highlight brush of the current color group.
Definition qpalette.h:98
const QBrush & button() const
Returns the button brush of the current color group.
Definition qpalette.h:84
const QBrush & text() const
Returns the text foreground brush of the current color group.
Definition qpalette.h:88
const QBrush & toolTipBase() const
Definition qpalette.h:91
const QBrush & windowText() const
Returns the window text (general foreground) brush of the current color group.
Definition qpalette.h:83
const QBrush & dark() const
Returns the dark brush of the current color group.
Definition qpalette.h:86
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:748
QPalette & operator=(const QPalette &palette)
Move-assigns other to this QPalette instance.
Definition qpalette.cpp:705
qint64 cacheKey() const
Returns a number that identifies the contents of this QPalette object.
Definition qpalette.cpp:943
const QBrush & toolTipText() const
Definition qpalette.h:92
const QBrush & link() const
Returns the unvisited link text brush of the current color group.
Definition qpalette.h:100
const QBrush & shadow() const
Returns the shadow brush of the current color group.
Definition qpalette.h:97
const QBrush & light() const
Returns the light brush of the current color group.
Definition qpalette.h:85
quint64 ResolveMask
Definition qpalette.h:113
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition qpalette.h:67
const QBrush & mid() const
Returns the mid brush of the current color group.
Definition qpalette.h:87
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:151
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:909
void setResolveMask(ResolveMask mask)
bool operator==(const QPalette &p) const
Returns true (usually quickly) if this palette is equal to p; otherwise returns false (slowly).
Definition qpalette.cpp:887
QPalette()
Constructs an empty palette object with no color roles set.
Definition qpalette.cpp:544
bool isBrushSet(ColorGroup cg, ColorRole cr) const
Definition qpalette.cpp:825
QDataStream & operator>>(QDataStream &s, QPalette &p)
Reads a palette from the stream, s into the palette p, and returns a reference to the stream.
ResolveMask resolveMask() const
Definition qpalette.cpp:999
const QBrush & midlight() const
Returns the midlight brush of the current color group.
Definition qpalette.h:94
~QPalette()
Destroys the palette.
Definition qpalette.cpp:687
ColorGroup
\value Disabled \value Active \value Inactive \value Normal synonym for Active
Definition qpalette.h:49
@ Current
Definition qpalette.h:49
@ Inactive
Definition qpalette.h:49
@ Disabled
Definition qpalette.h:49
@ NColorGroups
Definition qpalette.h:49
QPalette resolve(const QPalette &other) const
Returns a new QPalette that is a union of this instance and other.
Definition qpalette.cpp:963
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:146
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.
const QBrush & window() const
Returns the window (general background) brush of the current color group.
Definition qpalette.h:93
const QBrush & base() const
Returns the base brush of the current color group.
Definition qpalette.h:89
bool isCopyOf(const QPalette &p) const
Returns true if this palette and p are copies of each other, i.e.
@ HighlightedText
Definition qpalette.h:53
@ ToolTipBase
Definition qpalette.h:57
@ NColorRoles
Definition qpalette.h:60
@ BrightText
Definition qpalette.h:52
@ AlternateBase
Definition qpalette.h:55
@ ButtonText
Definition qpalette.h:52
@ WindowText
Definition qpalette.h:51
@ Highlight
Definition qpalette.h:53
@ ToolTipText
Definition qpalette.h:57
@ PlaceholderText
Definition qpalette.h:58
@ Midlight
Definition qpalette.h:51
@ LinkVisited
Definition qpalette.h:54
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:6018
\inmodule QtCore
Definition qvariant.h:65
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
[Window class with invokable method]
Definition window.h:11
QString text
QPushButton * button
[2]
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & showbase(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() | QTextStream::ShowBase) on stream and r...
GlobalColor
Definition qnamespace.h:27
@ white
Definition qnamespace.h:31
@ blue
Definition qnamespace.h:37
@ magenta
Definition qnamespace.h:39
@ darkBlue
Definition qnamespace.h:43
@ darkGray
Definition qnamespace.h:32
@ black
Definition qnamespace.h:30
#define qWarning
Definition qlogging.h:166
Button
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLsizei GLsizei GLchar * groupString
GLboolean GLboolean GLboolean GLboolean a
[7]
GLboolean r
[2]
GLuint color
[2]
GLboolean GLuint group
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLfloat GLfloat GLfloat GLfloat h
GLdouble s
[6]
Definition qopenglext.h:235
const GLubyte * c
GLfloat GLfloat p
[1]
GLfloat GLfloat GLfloat alpha
Definition qopenglext.h:418
static const int NumOldRoles
static QString groupsToString(const QPalette &p, QPalette::ColorRole cr)
static void qt_ensure_default_accent_color(QPalette &pal)
Definition qpalette.cpp:53
static const int oldRoles[7]
QDebug operator<<(QDebug dbg, const QPalette &p)
static void qt_placeholder_from_text(QPalette &pal, int alpha=50)
Definition qpalette.cpp:35
static constexpr QPalette::ResolveMask allResolveMask()
Definition qpalette.cpp:948
static QString rolesToString(const QPalette &p)
static void readV1ColorGroup(QDataStream &s, QPalette &pal, QPalette::ColorGroup grp)
static QColor qt_mix_colors(QColor a, QColor b)
Definition qpalette.cpp:19
static void qt_palette_from_color(QPalette &pal, const QColor &button)
Definition qpalette.cpp:71
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define QStringLiteral(str)
unsigned int uint
Definition qtypes.h:34
long long qint64
Definition qtypes.h:60
static const uint base
Definition qurlidna.cpp:20
QObject::connect nullptr
QSharedPointer< T > other(t)
[5]
aWidget window() -> setWindowTitle("New Window Title")
[2]