mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-10 21:32:20 +08:00
chore:更新取消按钮样式
This commit is contained in:
parent
e539fb5912
commit
525a90f441
@ -93,15 +93,17 @@ void AppDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, c
|
||||
progressBarOption.text = QString("%1%").arg(progress);
|
||||
progressBarOption.textVisible = true;
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter);
|
||||
QStyleOptionButton cancelOption;
|
||||
cancelOption.rect = QRect(progressRect.right() + 10, rect.top() + (rect.height() - 30) / 2, 70, 30);
|
||||
cancelOption.text = "取消";
|
||||
cancelOption.palette.setColor(QPalette::Button, QColor("#ff4444"));
|
||||
cancelOption.palette.setColor(QPalette::ButtonText, Qt::white);
|
||||
cancelOption.state = QStyle::State_Enabled;
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton, &cancelOption, painter);
|
||||
|
||||
// 修改后的取消按钮绘制代码
|
||||
QRect buttonRect(rect.right() - 80, rect.top() + (rect.height() - 30) / 2, 70, 30);
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(QColor("#ff4444")); // 红色背景
|
||||
painter->drawRoundedRect(buttonRect, 4, 4); // 圆角矩形
|
||||
|
||||
painter->setPen(Qt::white); // 白色文字
|
||||
painter->setFont(option.font);
|
||||
painter->drawText(buttonRect, Qt::AlignCenter, "取消");
|
||||
} else {
|
||||
// 修改后的更新按钮绘制代码
|
||||
QRect buttonRect(rect.right() - 80, rect.top() + (rect.height() - 30) / 2, 70, 30);
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(QColor("#e9effd")); // 背景色
|
||||
|
Loading…
x
Reference in New Issue
Block a user