From e539fb59127c9e97fb7c5c6c2e9532b5ee936dd8 Mon Sep 17 00:00:00 2001 From: momen Date: Sun, 15 Jun 2025 16:44:28 +0800 Subject: [PATCH] =?UTF-8?q?chore:=E5=BC=BA=E5=88=B6=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/appdelegate.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/appdelegate.cpp b/src/appdelegate.cpp index f68492f..c6d6235 100644 --- a/src/appdelegate.cpp +++ b/src/appdelegate.cpp @@ -101,15 +101,15 @@ void AppDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, c cancelOption.state = QStyle::State_Enabled; QApplication::style()->drawControl(QStyle::CE_PushButton, &cancelOption, painter); } else { - QStyleOptionButton buttonOption; - buttonOption.rect = QRect(rect.right() - 80, rect.top() + (rect.height() - 30) / 2, 70, 30); - buttonOption.text = "更新"; - buttonOption.state = QStyle::State_Enabled; - QPalette palette = buttonOption.palette; - palette.setColor(QPalette::Button, QColor("#e9effd")); // 背景色 - palette.setColor(QPalette::ButtonText, QColor("#2563EB")); // 文字颜色 - buttonOption.palette = palette; - QApplication::style()->drawControl(QStyle::CE_PushButton, &buttonOption, painter); + // 修改后的更新按钮绘制代码 + QRect buttonRect(rect.right() - 80, rect.top() + (rect.height() - 30) / 2, 70, 30); + painter->setPen(Qt::NoPen); + painter->setBrush(QColor("#e9effd")); // 背景色 + painter->drawRoundedRect(buttonRect, 4, 4); // 圆角矩形 + + painter->setPen(QColor("#2563EB")); // 文字颜色 + painter->setFont(option.font); + painter->drawText(buttonRect, Qt::AlignCenter, "更新"); } painter->restore();