From 61d3ae45cbb1546c75605c70ba4ca5ea2dbce11a Mon Sep 17 00:00:00 2001 From: yuanxing Date: Fri, 28 Feb 2025 16:09:44 +0800 Subject: [PATCH] fix(style):improve QLineEdit bg color, same with QCombobox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 完善QLineEdit背景颜色,与QCombobox保持一致 Relates #57766 --- lib/theme/style.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/theme/style.cpp b/lib/theme/style.cpp index 783135a..8d5a3ce 100644 --- a/lib/theme/style.cpp +++ b/lib/theme/style.cpp @@ -1949,7 +1949,9 @@ void Style::drawPEFrameLineEdit(const QStyleOption *option, QPainter *painter, c { const auto &rect = option->rect; - auto background = DEFAULT_PALETTE()->getColor(option->state, Palette::WINDOW); + // QLineEdit::paintEvent中设置option->state |= QStyle::State_Sunken,导致获取的获取颜色为Sunken状态下的控件颜色,与预期不一致 + // 指定获取ACTIVE状态下的控件颜色,与QCombobox颜色保持一致 + auto background = DEFAULT_PALETTE()->getColor(Palette::ACTIVE, Palette::WIDGET); auto border = DEFAULT_PALETTE()->getColor(option->state, Palette::BORDER); // 控件高度不足够绘制边框 -- Gitee