Fixed two issues.

1. The border color on Win10 when in light theme is also #707070, not pure white.
2. The brush color of the Acrylic effect is reversed before, it is now correct.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-10-21 11:10:51 +08:00
parent f3e863e14b
commit 8c21be9e64
3 changed files with 8 additions and 7 deletions

View File

@ -216,7 +216,7 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
}); });
connect(ui->blurEffectCB, &QCheckBox::stateChanged, this, [this](int state) { connect(ui->blurEffectCB, &QCheckBox::stateChanged, this, [this](int state) {
const bool enable = state == Qt::Checked; const bool enable = state == Qt::Checked;
QColor color = QColor(255, 255, 255, 0); QColor color = Qt::white;
if (isGreaterThanWin10_1803() && ui->forceAcrylicCB->isChecked()) { if (isGreaterThanWin10_1803() && ui->forceAcrylicCB->isChecked()) {
if (enable) { if (enable) {
color = QColorDialog::getColor(color, color = QColorDialog::getColor(color,
@ -280,8 +280,7 @@ bool Widget::shouldDrawThemedBorder(const bool ignoreWindowState) const
QColor Widget::activeBorderColor() const QColor Widget::activeBorderColor() const
{ {
return isThemeColorEnabled() ? m_cThemeColor return isThemeColorEnabled() ? m_cThemeColor : m_cDefaultActiveBorderColor;
: (isDarkModeEnabled() ? m_cDefaultActiveBorderColor : Qt::white);
} }
QColor Widget::inactiveBorderColor() const QColor Widget::inactiveBorderColor() const

View File

@ -2415,9 +2415,11 @@ bool WinNativeEventFilter::setBlurEffectEnabled(void *handle,
// The gradient color must be set otherwise it'll look // The gradient color must be set otherwise it'll look
// like a classic blur. Use semi-transparent gradient // like a classic blur. Use semi-transparent gradient
// color to get better appearance. // color to get better appearance.
const QColor color = gradientColor.isValid() ? gradientColor const QColor color = gradientColor.isValid() ? gradientColor : Qt::white;
: QColor(255, 255, 255, 0); accentPolicy.GradientColor = qRgba(color.blue(),
accentPolicy.GradientColor = color.rgba(); color.green(),
color.red(),
color.alpha());
} else { } else {
// Enabling the Acrylic effect for Win32 windows is // Enabling the Acrylic effect for Win32 windows is
// very buggy and it's a bug of Windows 10 itself so // very buggy and it's a bug of Windows 10 itself so

View File

@ -144,7 +144,7 @@ public:
// On Win10 it's the Acrylic effect. // On Win10 it's the Acrylic effect.
static bool setBlurEffectEnabled(void *handle /* HWND */, static bool setBlurEffectEnabled(void *handle /* HWND */,
const bool enabled = true, const bool enabled = true,
const QColor &gradientColor = QColor(255, 255, 255, 0)); const QColor &gradientColor = Qt::white);
// Thin wrapper of DwmExtendFrameIntoClientArea(). // Thin wrapper of DwmExtendFrameIntoClientArea().
static void updateFrameMargins(void *handle /* HWND */); static void updateFrameMargins(void *handle /* HWND */);