QPalette Class | Qt GUI 5.15.18 (original) (raw)
Member Function Documentation
QPalette::QPalette(QPalette &&other)
Move-constructs a QPalette instance, making it point at the same object that other was pointing to.
After being moved from, you can only assign to or destroy other. Any other operation will result in undefined behavior.
This function was introduced in Qt 5.4.
QPalette::QPalette(const QPalette &p)
Constructs a copy of p.
This constructor is fast thanks to implicit sharing.
QPalette::QPalette(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)
Constructs a palette. You can pass either brushes, pixmaps or plain colors for windowText, button, light, dark, mid, text, bright_text, base and window.
See also QBrush.
QPalette::QPalette(const QColor &button, const QColor &window)
Constructs a palette from a button color and a window. The other colors are automatically calculated, based on these colors.
QPalette::QPalette(Qt::GlobalColor button)
Constructs a palette from the button color. The other colors are automatically calculated, based on this color. Window
will be the button color as well.
QPalette::QPalette(const QColor &button)
Constructs a palette from the button color. The other colors are automatically calculated, based on this color. Window
will be the button color as well.
QPalette::QPalette()
Constructs an empty palette object with no color roles set.
When used as the palette of a QWidget the colors are resolved as described by QWidget::setPalette().
See also QApplication::setPalette() and QApplication::palette().
QPalette &QPalette::operator=(QPalette &&other)
Move-assigns other to this QPalette instance.
This function was introduced in Qt 5.2.
QPalette &QPalette::operator=(const QPalette &p)
Assigns p to this palette and returns a reference to this palette.
This operation is fast thanks to implicit sharing.
QPalette::~QPalette()
Destroys the palette.
const QBrush &QPalette::alternateBase() const
Returns the alternate base brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::base() const
Returns the base brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::brightText() const
Returns the bright text foreground brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::brush(QPalette::ColorGroup group, QPalette::ColorRole role) const
Returns the brush in the specified color group, used for the given color role.
See also color(), setBrush(), and ColorRole.
const QBrush &QPalette::brush(QPalette::ColorRole role) const
This is an overloaded function.
Returns the brush that has been set for the given color role in the current ColorGroup.
See also color(), setBrush(), and ColorRole.
const QBrush &QPalette::button() const
Returns the button brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::buttonText() const
Returns the button text foreground brush of the current color group.
See also ColorRole and brush().
qint64 QPalette::cacheKey() const
Returns a number that identifies the contents of this QPalette object. Distinct QPalette objects can have the same key if they refer to the same contents.
The cacheKey() will change when the palette is altered.
const QColor &QPalette::color(QPalette::ColorGroup group, QPalette::ColorRole role) const
Returns the color in the specified color group, used for the given color role.
See also brush(), setColor(), and ColorRole.
const QColor &QPalette::color(QPalette::ColorRole role) const
This is an overloaded function.
Returns the color that has been set for the given color role in the current ColorGroup.
See also brush() and ColorRole.
QPalette::ColorGroup QPalette::currentColorGroup() const
Returns the palette's current color group.
See also setCurrentColorGroup().
const QBrush &QPalette::dark() const
Returns the dark brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::highlight() const
Returns the highlight brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::highlightedText() const
Returns the highlighted text brush of the current color group.
See also ColorRole and brush().
bool QPalette::isBrushSet(QPalette::ColorGroup cg, QPalette::ColorRole cr) const
Returns true
if the ColorGroup cg and ColorRole cr has been set previously on this palette; otherwise returns false
.
This function was introduced in Qt 4.2.
See also setBrush().
bool QPalette::isCopyOf(const QPalette &p) const
Returns true
if this palette and p are copies of each other, i.e. one of them was created as a copy of the other and neither was subsequently modified; otherwise returns false
. This is much stricter than equality.
See also operator=() and operator==().
bool QPalette::isEqual(QPalette::ColorGroup cg1, QPalette::ColorGroup cg2) const
Returns true
(usually quickly) if color group cg1 is equal to cg2; otherwise returns false
.
const QBrush &QPalette::light() const
Returns the light brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::link() const
Returns the unvisited link text brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::linkVisited() const
Returns the visited link text brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::mid() const
Returns the mid brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::midlight() const
Returns the midlight brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::placeholderText() const
Returns the placeholder text brush of the current color group.
Note: Before Qt 5.12, the placeholder text color was hard-coded in the code as QPalette::text().color() where an alpha of 128 was applied. We continue to support this behavior by default, unless you set your own brush. One can get back the original placeholder color setting the special QBrush default constructor as placeholder brush.
This function was introduced in Qt 5.12.
See also ColorRole and brush().
QPalette QPalette::resolve(const QPalette &other) const
Returns a new QPalette that is a union of this instance and other. Color roles set in this instance take precedence.
void QPalette::setBrush(QPalette::ColorRole role, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette.
See also brush(), setColor(), and ColorRole.
void QPalette::setBrush(QPalette::ColorGroup group, QPalette::ColorRole role, const QBrush &brush)
This is an overloaded function.
Sets the brush in the specified color group, used for the given color role, to brush.
See also brush(), setColor(), and ColorRole.
void QPalette::setColor(QPalette::ColorGroup group, QPalette::ColorRole role, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid color.
See also setBrush(), color(), and ColorRole.
void QPalette::setColor(QPalette::ColorRole role, const QColor &color)
This is an overloaded function.
Sets the color used for the given color role, in all color groups, to the specified solid color.
See also brush(), setColor(), and ColorRole.
void QPalette::setColorGroup(QPalette::ColorGroup cg, 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. You can pass either brushes, pixmaps or plain colors for windowText, button, light, dark, mid, text, bright_text, base and window.
See also QBrush.
void QPalette::setCurrentColorGroup(QPalette::ColorGroup cg)
Set the palette's current color group to cg.
See also currentColorGroup().
const QBrush &QPalette::shadow() const
Returns the shadow brush of the current color group.
See also ColorRole and brush().
void QPalette::swap(QPalette &other)
Swaps this palette instance with other. This function is very fast and never fails.
This function was introduced in Qt 5.0.
const QBrush &QPalette::text() const
Returns the text foreground brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::toolTipBase() const
Returns the tool tip base brush of the current color group. This brush is used by QToolTip and QWhatsThis.
Note: Tool tips use the Inactive color group of QPalette, because tool tips are not active windows.
This function was introduced in Qt 4.4.
See also ColorRole and brush().
const QBrush &QPalette::toolTipText() const
Returns the tool tip text brush of the current color group. This brush is used by QToolTip and QWhatsThis.
Note: Tool tips use the Inactive color group of QPalette, because tool tips are not active windows.
This function was introduced in Qt 4.4.
See also ColorRole and brush().
const QBrush &QPalette::window() const
Returns the window (general background) brush of the current color group.
See also ColorRole and brush().
const QBrush &QPalette::windowText() const
Returns the window text (general foreground) brush of the current color group.
See also ColorRole and brush().
QVariant QPalette::operator QVariant() const
Returns the palette as a QVariant
bool QPalette::operator!=(const QPalette &p) const
Returns true
(slowly) if this palette is different from p; otherwise returns false
(usually quickly).
Note: The current ColorGroup is not taken into account when comparing palettes
See also operator==().
bool QPalette::operator==(const QPalette &p) const
Returns true
(usually quickly) if this palette is equal to p; otherwise returns false
(slowly).
Note: The current ColorGroup is not taken into account when comparing palettes
See also operator!=().