fix:修正使用软件名获取下载的问题

This commit is contained in:
momen 2025-06-09 21:10:37 +08:00
parent 2cb69c72f3
commit 9ae6e00d71
2 changed files with 8 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);
}