Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qpalette.cpp File Reference
#include "qpalette.h"
#include "qguiapplication.h"
#include "qguiapplication_p.h"
#include "qdatastream.h"
#include "qvariant.h"
#include "qdebug.h"
#include <QtCore/qmetaobject.h>
#include "moc_qpalette.cpp"
+ Include dependency graph for qpalette.cpp:

Go to the source code of this file.

Classes

class  QPalettePrivate
 
class  QPalettePrivate::Data
 

Functions

static constexpr QPalette::ResolveMask colorRoleOffset (QPalette::ColorGroup colorGroup)
 
static constexpr QPalette::ResolveMask bitPosition (QPalette::ColorGroup colorGroup, QPalette::ColorRole colorRole)
 
static QColor qt_mix_colors (QColor a, QColor b)
 
static void qt_placeholder_from_text (QPalette &pal, int alpha=50)
 
static void qt_ensure_default_accent_color (QPalette &pal)
 
static void qt_palette_from_color (QPalette &pal, const QColor &button)
 
static constexpr QPalette::ResolveMask allResolveMask ()
 
static void readV1ColorGroup (QDataStream &s, QPalette &pal, QPalette::ColorGroup grp)
 
static QString groupsToString (const QPalette &p, QPalette::ColorRole cr)
 
static QString rolesToString (const QPalette &p)
 
QDebug operator<< (QDebug dbg, const QPalette &p)
 

Variables

static QT_BEGIN_NAMESPACE int qt_palette_count = 1
 
static const int NumOldRoles = 7
 
static const int oldRoles [7]
 

Function Documentation

◆ allResolveMask()

static constexpr QPalette::ResolveMask allResolveMask ( )
staticconstexpr

Definition at line 994 of file qpalette.cpp.

References bitPosition(), QPalette::NColorGroups, and QPalette::NColorRoles.

Referenced by QPalette::resolve().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bitPosition()

static constexpr QPalette::ResolveMask bitPosition ( QPalette::ColorGroup  colorGroup,
QPalette::ColorRole  colorRole 
)
staticconstexpr

Definition at line 23 of file qpalette.cpp.

References QPalette::AccentColor, colorRoleOffset(), and QPalette::NoRole.

Referenced by allResolveMask(), QPalette::isBrushSet(), QQuickPaletteColorProvider::resetColor(), QQuickPaletteColorProvider::resetColor(), QPalette::resolve(), QPalette::setBrush(), and QPalette::setColorGroup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ colorRoleOffset()

static constexpr QPalette::ResolveMask colorRoleOffset ( QPalette::ColorGroup  colorGroup)
staticconstexpr

Definition at line 17 of file qpalette.cpp.

References QPalette::NColorRoles, and qToUnderlying().

Referenced by bitPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ groupsToString()

static QString groupsToString ( const QPalette p,
QPalette::ColorRole  cr 
)
static

Definition at line 1274 of file qpalette.cpp.

References QString::fromUtf8(), QColor::HexArgb, and QPalette::NColorGroups.

Referenced by rolesToString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<()

QDebug operator<< ( QDebug  dbg,
const QPalette p 
)

Definition at line 1311 of file qpalette.cpp.

References Qt::hex(), rolesToString(), and Qt::showbase().

+ Here is the call graph for this function:

◆ qt_ensure_default_accent_color()

static void qt_ensure_default_accent_color ( QPalette pal)
static

Definition at line 108 of file qpalette.cpp.

References QPalette::AccentColor, QPalette::Base, QPalette::base(), QPalette::brush(), QBrush::color(), QPalette::Highlight, i, QPalette::isBrushSet(), QColor::lighter(), QColor::lightness(), QPalette::NColorGroups, QPalette::setBrush(), and QPalette::text().

Referenced by QPalette::QPalette(), QPalette::QPalette(), and qt_palette_from_color().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_mix_colors()

static QColor qt_mix_colors ( QColor  a,
QColor  b 
)
static

Definition at line 74 of file qpalette.cpp.

Referenced by QPalette::setColorGroup().

+ Here is the caller graph for this function:

◆ qt_palette_from_color()

static void qt_palette_from_color ( QPalette pal,
const QColor button 
)
static

Definition at line 126 of file qpalette.cpp.

References QPalette::Active, Qt::black, button, QPalette::Disabled, QPalette::Inactive, qt_ensure_default_accent_color(), qt_placeholder_from_text(), QPalette::setColorGroup(), and Qt::white.

Referenced by QPalette::QPalette(), QPalette::QPalette(), and QPalette::QPalette().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_placeholder_from_text()

static void qt_placeholder_from_text ( QPalette pal,
int  alpha = 50 
)
static

Derive undefined \l PlaceholderText colors from \l Text colors. Unless already set, PlaceholderText colors will be derived from their Text pendents. Colors of existing PlaceHolderText brushes will not be replaced.

alpha represents the dim factor as a percentage. By default, a PlaceHolderText color becomes a 50% more transparent version of the corresponding Text color.

Definition at line 90 of file qpalette.cpp.

References QPalette::color(), QPalette::isBrushSet(), QPalette::NColorGroups, QPalette::PlaceholderText, QColor::setAlpha(), QPalette::setColor(), and QPalette::Text.

Referenced by QPalette::QPalette(), QPalette::QPalette(), and qt_palette_from_color().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readV1ColorGroup()

static void readV1ColorGroup ( QDataStream s,
QPalette pal,
QPalette::ColorGroup  grp 
)
static

Definition at line 1114 of file qpalette.cpp.

References i, NumOldRoles, oldRoles, and QPalette::setColor().

Referenced by QPalette::operator>>().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rolesToString()

static QString rolesToString ( const QPalette p)
static

Definition at line 1293 of file qpalette.cpp.

References QString::chop(), QString::fromUtf8(), groupsToString(), QPalette::NColorRoles, and QStringLiteral.

Referenced by operator<<().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ NumOldRoles

const int NumOldRoles = 7
static

Definition at line 1076 of file qpalette.cpp.

Referenced by readV1ColorGroup().

◆ oldRoles

◆ qt_palette_count

QT_BEGIN_NAMESPACE int qt_palette_count = 1
static

Definition at line 15 of file qpalette.cpp.