WindowsQPA: Adjust close button and hover color for custom titlebar

Adjust toe color of the close button to match the native color. Adjust
the hover text color for the close in light mode to match the native
behavior.

Fixes: QTBUG-133945
Change-Id: I2c9fafba9fee65f45f3878168b67b0d0a4b2a54c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit b24b9bba68821d4abb905d434e4b9442c65ff0c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2025-03-11 15:48:13 +01:00 committed by Qt Cherry-pick Bot
parent 5641db1f9f
commit ef2731cfc4

View File

@ -3484,7 +3484,7 @@ void QWindowsWindow::updateCustomTitlebar()
qApp->styleHints()->colorScheme() == Qt::ColorScheme::Dark;
const bool isWindows11orAbove = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows11;
const QBrush closeButtonBrush(QColor(0xC4, 0x2B, 0x1C, 255));
const QBrush closeButtonBrush(QColor(0xC4, 0x2C, 0x1E, 255));
const QBrush minMaxButtonBrush = QBrush(isDarkmode ? QColor(0xFF, 0xFF, 0xFF, 0x40) : QColor(0x00, 0x00, 0x00, 0x20));
const QBrush titleBarBackgroundColor = QBrush(isDarkmode ? QColor(0x1F, 0x1F, 0x1F, 0xFF) : QColor(0xF3, 0xF3, 0xF3, 0xFF));
const QPen textPen = QPen(isDarkmode ? QColor(0xFF, 0xFF, 0xFD, 0xFF) : QColor(0x00, 0x00, 0x00, 0xFF));
@ -3573,9 +3573,12 @@ void QWindowsWindow::updateCustomTitlebar()
_q_drawCustomTitleBarButton(p, rect);
else
p.drawRect(rect);
const QPen closeButtonHoveredPen = QPen(QColor(0xFF, 0xFF, 0xFD, 0xFF));
p.setPen(closeButtonHoveredPen);
} else {
p.setPen(textPen);
}
p.setPen(textPen);
p.drawText(rect,QStringLiteral("\uE8BB"), QTextOption(Qt::AlignVCenter | Qt::AlignHCenter));
p.drawText(rect, QStringLiteral("\uE8BB"), QTextOption(Qt::AlignVCenter | Qt::AlignHCenter));
buttons++;
}