mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-11 05:42:20 +08:00
chore:下载完成后改为“下载完成”样式
This commit is contained in:
parent
7fb697f56e
commit
567a24a6ec
@ -104,14 +104,25 @@ void AppDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, c
|
||||
painter->setFont(option.font);
|
||||
painter->drawText(buttonRect, Qt::AlignCenter, "取消");
|
||||
} else {
|
||||
QString packageName = index.data(Qt::UserRole + 1).toString();
|
||||
bool isDownloaded = m_downloads.contains(packageName) && !m_downloads[packageName].isDownloading;
|
||||
|
||||
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, "更新");
|
||||
if (isDownloaded) {
|
||||
// 下载完成状态
|
||||
painter->setBrush(QColor("#10B981")); // 绿色背景
|
||||
painter->drawRoundedRect(buttonRect, 4, 4);
|
||||
painter->setPen(Qt::white);
|
||||
painter->drawText(buttonRect, Qt::AlignCenter, "下载完成");
|
||||
} else {
|
||||
// 更新按钮状态
|
||||
painter->setBrush(QColor("#e9effd")); // 背景色
|
||||
painter->drawRoundedRect(buttonRect, 4, 4);
|
||||
painter->setPen(QColor("#2563EB")); // 文字颜色
|
||||
painter->drawText(buttonRect, Qt::AlignCenter, "更新");
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
|
Loading…
x
Reference in New Issue
Block a user