MCPcopy Create free account
hub / github.com/Zalafina/QKeyMapper / updateColorLabel

Method updateColorLabel

QKeyMapper/colorpickerwidget.cpp:89–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void ColorPickerWidget::updateColorLabel(const QColor &color)
90{
91 if (colorLabel == Q_NULLPTR) {
92 return;
93 }
94
95 const QPalette widgetPalette = palette();
96 const QColor activeColor = color.isValid()
97 ? color
98 : widgetPalette.color(QPalette::Active, QPalette::Window);
99 const QColor inactiveColor = color.isValid()
100 ? color
101 : widgetPalette.color(QPalette::Inactive, QPalette::Window);
102 const QColor disabledColor = mutedDisabledSwatchColor(color, widgetPalette);
103
104 QPalette labelPalette = colorLabel->palette();
105 labelPalette.setColor(QPalette::Active, colorLabel->backgroundRole(), activeColor);
106 labelPalette.setColor(QPalette::Inactive, colorLabel->backgroundRole(), inactiveColor);
107 labelPalette.setColor(QPalette::Disabled, colorLabel->backgroundRole(), disabledColor);
108 colorLabel->setPalette(labelPalette);
109 colorLabel->update();
110}
111
112#if 0
113void ColorPickerWidget::setUILanguage(int languageindex)

Callers

nothing calls this directly

Calls 4

mutedDisabledSwatchColorFunction · 0.85
isValidMethod · 0.80
setColorMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected