支持显示内核

This commit is contained in:
2024-04-22 22:47:42 +08:00
parent 5110628c24
commit 7ca314116c
5 changed files with 161 additions and 3 deletions

View File

@@ -1,11 +1,38 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "kernelinformation.h"
#include <QStandardItemModel>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
RefreshKernelList();
}
void MainWindow::RefreshKernelList()
{
KernelInformation *information = new KernelInformation();
connect(information, &KernelInformation::loadFinished, this, [this, information](){
qDebug() << information->get_listData();
RefreshKernelListView(information);
delete information;
});
information->LoadInfo();
}
void MainWindow::RefreshKernelListView(KernelInformation *info)
{
// 更新列表
int count = info->get_count();
QStandardItemModel *model = new QStandardItemModel();
for(int i = 0; i <= count; i++) {
model->setItem(0, i, new QStandardItem(info->get_name(i)));
}
ui->m_kernelShow->setModel(model);
}
MainWindow::~MainWindow()