feat(production): 界面表格优化
This commit is contained in:
+10
-3
@@ -1,5 +1,6 @@
|
||||
#include "logpage.h"
|
||||
#include "ui_logpage.h"
|
||||
#include "uihelpers.h"
|
||||
|
||||
#include "../models/logrecord.h"
|
||||
#include "../repositories/logrepository.h"
|
||||
@@ -7,7 +8,6 @@
|
||||
#include <QAbstractItemView>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QHeaderView>
|
||||
#include <QTableWidget>
|
||||
#include <QTableWidgetItem>
|
||||
|
||||
@@ -19,7 +19,12 @@ LogPage::LogPage(QWidget *parent)
|
||||
|
||||
ui->logTable->setColumnCount(6);
|
||||
ui->logTable->setHorizontalHeaderLabels(QStringList() << "时间" << "类型" << "模块" << "动作" << "内容" << "状态");
|
||||
ui->logTable->horizontalHeader()->setStretchLastSection(true);
|
||||
const int dateTimeWidth = UiHelpers::textColumnWidth(
|
||||
ui->logTable, "2026-10-30 23:59:59");
|
||||
UiHelpers::configureTableColumns(
|
||||
ui->logTable,
|
||||
QList<int>() << dateTimeWidth << 100 << 100 << 110 << 360 << 80,
|
||||
4, 60);
|
||||
ui->logTable->verticalHeader()->setVisible(false);
|
||||
ui->logTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
ui->logTable->setAlternatingRowColors(true);
|
||||
@@ -67,6 +72,8 @@ void LogPage::addLogRow(const QString &time, const QString &type, const QString
|
||||
const QStringList values = QStringList()
|
||||
<< time << type << module << action << content << status;
|
||||
for (int col = 0; col < values.size(); ++col) {
|
||||
ui->logTable->setItem(0, col, new QTableWidgetItem(values.at(col)));
|
||||
QTableWidgetItem *item = new QTableWidgetItem(values.at(col));
|
||||
if (col == 4) item->setTextAlignment(Qt::AlignCenter);
|
||||
ui->logTable->setItem(0, col, item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user