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
Pick-to: 6.9
Change-Id: I2c9fafba9fee65f45f3878168b67b0d0a4b2a54c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Wladimir Leuschner 2025-03-11 15:48:13 +01:00
parent 39ec71237f
commit b24b9bba68

View File

@ -3500,7 +3500,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));
@ -3584,9 +3584,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++;
}