From 70e0e04e4ce352267ac74f2021bf2d96c61359af Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Wed, 24 Apr 2024 21:14:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=89=E6=8B=A9=E5=86=85?= =?UTF-8?q?=E6=A0=B8=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mainwindow.cpp | 10 +++++++++- mainwindow.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 71b78c1..2122c90 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -55,7 +55,15 @@ void MainWindow::on_m_refreshButton_clicked() void MainWindow::on_m_installButton_clicked() { - KernelInstaller *installer = new KernelInstaller(kernelInformation->get_pkgName(0)); + QModelIndex list = ui->m_kernelShow->selectionModel()->currentIndex(); + int row = list.row(); + if(row <= 0) { + // 未选中任何内容 + QMessageBox::critical(this, tr("Error"), tr("Nothing to choose")); + return; + } + // 获取选中行 + KernelInstaller *installer = new KernelInstaller(kernelInformation->get_pkgName(row)); installer->show(); } diff --git a/mainwindow.h b/mainwindow.h index f1f512b..d81a6fb 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -2,6 +2,7 @@ #define MAINWINDOW_H #include +#include #include "kernelinformation.h" #include "kernelinstaller.h"