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
b6de24e098
commit
e539fb5912
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user