aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/basic/qquickbasictheme.cpp
diff options
context:
space:
mode:
authorMohammadHossein Qanbari <mohammad.qanbari@qt.io>2025-05-23 09:38:11 +0200
committerMohammadHossein Qanbari <mohammad.qanbari@qt.io>2025-05-26 12:03:12 +0200
commitc6eb31a8e17ef69c41313a7937b6bffd6c331ceb (patch)
treea9760b0bee1cd3a5f924c5c84ffbb454d093da5e /src/quickcontrols/basic/qquickbasictheme.cpp
parentfea242475c9c7ce17f89877b1bf2e698dd9d63c7 (diff)
Basic style: don't use QColor(QRgb), use QColor::fromRgba() instead
The QColor(QRgb) constructor ignores the alpha channel. To include the alpha channel fromRgba() static function should be used to create the QColor instance Change-Id: I98734084cdcd5df82e8103ddbdb487c4f64c65b4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quickcontrols/basic/qquickbasictheme.cpp')
-rw-r--r--src/quickcontrols/basic/qquickbasictheme.cpp52
1 files changed, 28 insertions, 24 deletions
diff --git a/src/quickcontrols/basic/qquickbasictheme.cpp b/src/quickcontrols/basic/qquickbasictheme.cpp
index 70c6372f52..43577aad67 100644
--- a/src/quickcontrols/basic/qquickbasictheme.cpp
+++ b/src/quickcontrols/basic/qquickbasictheme.cpp
@@ -39,46 +39,50 @@ void QQuickBasicTheme::initialize(QQuickTheme *theme)
const QRgb disabledWindowText(isDarkSystemTheme ? 0xFF3F4040 : 0xFFBDBEBF);
const QRgb placeholderText(isDarkSystemTheme ? 0x88C8C9CB : 0x88353637);
- systemPalette.setColor(QPalette::Base, base);
- systemPalette.setColor(QPalette::Disabled, QPalette::Base, disabledBase);
+ systemPalette.setColor(QPalette::Base, QColor::fromRgba(base));
+ systemPalette.setColor(QPalette::Disabled, QPalette::Base, QColor::fromRgba(disabledBase));
- systemPalette.setColor(QPalette::Button, button);
+ systemPalette.setColor(QPalette::Button, QColor::fromRgba(button));
- systemPalette.setColor(QPalette::ButtonText, buttonText);
- systemPalette.setColor(QPalette::Disabled, QPalette::ButtonText, disabledButtonText);
+ systemPalette.setColor(QPalette::ButtonText, QColor::fromRgba(buttonText));
+ systemPalette.setColor(QPalette::Disabled, QPalette::ButtonText,
+ QColor::fromRgba(disabledButtonText));
- systemPalette.setColor(QPalette::BrightText, brightText);
- systemPalette.setColor(QPalette::Disabled, QPalette::BrightText, disabledBrightText);
+ systemPalette.setColor(QPalette::BrightText, QColor::fromRgba(brightText));
+ systemPalette.setColor(QPalette::Disabled, QPalette::BrightText,
+ QColor::fromRgba(disabledBrightText));
- systemPalette.setColor(QPalette::Dark, dark);
+ systemPalette.setColor(QPalette::Dark, QColor::fromRgba(dark));
- systemPalette.setColor(QPalette::Highlight, highlight);
- systemPalette.setColor(QPalette::Disabled, QPalette::Highlight, disabledHighlight);
+ systemPalette.setColor(QPalette::Highlight, QColor::fromRgba(highlight));
+ systemPalette.setColor(QPalette::Disabled, QPalette::Highlight,
+ QColor::fromRgba(disabledHighlight));
- systemPalette.setColor(QPalette::HighlightedText, highlightedText);
+ systemPalette.setColor(QPalette::HighlightedText, QColor::fromRgba(highlightedText));
- systemPalette.setColor(QPalette::Light, light);
+ systemPalette.setColor(QPalette::Light, QColor::fromRgba(light));
- systemPalette.setColor(QPalette::Link, link);
+ systemPalette.setColor(QPalette::Link, QColor::fromRgba(link));
- systemPalette.setColor(QPalette::Mid, mid);
+ systemPalette.setColor(QPalette::Mid, QColor::fromRgba(mid));
- systemPalette.setColor(QPalette::Midlight, midlight);
+ systemPalette.setColor(QPalette::Midlight, QColor::fromRgba(midlight));
- systemPalette.setColor(QPalette::Text, text);
- systemPalette.setColor(QPalette::Disabled, QPalette::Text, disabledText);
+ systemPalette.setColor(QPalette::Text, QColor::fromRgba(text));
+ systemPalette.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgba(disabledText));
- systemPalette.setColor(QPalette::Shadow, shadow);
+ systemPalette.setColor(QPalette::Shadow, QColor::fromRgba(shadow));
- systemPalette.setColor(QPalette::ToolTipBase, toolTipBase);
- systemPalette.setColor(QPalette::ToolTipText, toolTipText);
+ systemPalette.setColor(QPalette::ToolTipBase, QColor::fromRgba(toolTipBase));
+ systemPalette.setColor(QPalette::ToolTipText, QColor::fromRgba(toolTipText));
- systemPalette.setColor(QPalette::Window, window);
+ systemPalette.setColor(QPalette::Window, QColor::fromRgba(window));
- systemPalette.setColor(QPalette::WindowText, windowText);
- systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, disabledWindowText);
+ systemPalette.setColor(QPalette::WindowText, QColor::fromRgba(windowText));
+ systemPalette.setColor(QPalette::Disabled, QPalette::WindowText,
+ QColor::fromRgba(disabledWindowText));
- systemPalette.setColor(QPalette::PlaceholderText, placeholderText);
+ systemPalette.setColor(QPalette::PlaceholderText, QColor::fromRgba(placeholderText));
theme->setPalette(QQuickTheme::System, systemPalette);
}