mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-11-04 00:02:21 +08:00
fix:修正使用软件名获取下载的问题
This commit is contained in:
parent
2cb69c72f3
commit
9ae6e00d71
@ -140,10 +140,11 @@ bool AppDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QS
|
||||
// 更新按钮区域
|
||||
QRect buttonRect(rect.right() - 80, rect.top() + (rect.height() - 30) / 2, 70, 30);
|
||||
if (buttonRect.contains(mouseEvent->pos())) {
|
||||
QString appName = index.data(Qt::DisplayRole).toString();
|
||||
// 修改这里:使用Qt::UserRole +1获取包名
|
||||
QString packageName = index.data(Qt::UserRole + 1).toString();
|
||||
m_isDownloading = true;
|
||||
m_progress = 0;
|
||||
m_downloadManager->startDownload(appName);
|
||||
m_downloadManager->startDownload(packageName);
|
||||
emit updateDisplay(); // 触发重绘
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "downloadmanager.h"
|
||||
#include <QDebug> // 包含 QDebug 头文件
|
||||
|
||||
DownloadManager::DownloadManager(QObject *parent) : QObject(parent), m_process(new QProcess(this))
|
||||
{
|
||||
@ -17,7 +18,11 @@ DownloadManager::~DownloadManager()
|
||||
|
||||
void DownloadManager::startDownload(const QString &appName)
|
||||
{
|
||||
// 输出开始下载的日志
|
||||
qDebug() << "开始下载应用:" << appName;
|
||||
QString command = QString("aptss download --print-uris %1").arg(appName);
|
||||
// 输出执行的命令日志
|
||||
qDebug() << "执行命令:" << command;
|
||||
m_process->start(command);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user