优化空列表展示

This commit is contained in:
zhaominyong 2022-03-14 09:16:27 +08:00
parent 12ec5665d2
commit ec8fb3abba
3 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#define BackupPointListDialog_H #define BackupPointListDialog_H
#include <QDialog> #include <QDialog>
#include <QHeaderView>
#include <QTableWidget> #include <QTableWidget>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>

View File

@ -154,9 +154,11 @@ void ManageBackupPointList::insertLines(const QList<ParseBackupList::BackupPoint
m_tableWidget->sortItems(Column_Index::Backup_Time, Qt::DescendingOrder); m_tableWidget->sortItems(Column_Index::Backup_Time, Qt::DescendingOrder);
m_labelEmpty->setVisible(false); m_labelEmpty->setVisible(false);
m_labelEmptyText->setVisible(false); m_labelEmptyText->setVisible(false);
m_tableWidget->horizontalHeader()->setVisible(true);
} else { } else {
m_labelEmpty->setVisible(true); m_labelEmpty->setVisible(true);
m_labelEmptyText->setVisible(true); m_labelEmptyText->setVisible(true);
m_tableWidget->horizontalHeader()->setVisible(false);
} }
} }
@ -174,6 +176,7 @@ void ManageBackupPointList::deleteBackupPoint(ParseBackupList::BackupPoint backu
if (this->m_tableWidget->rowCount() ==0) { if (this->m_tableWidget->rowCount() ==0) {
m_labelEmpty->setVisible(true); m_labelEmpty->setVisible(true);
m_labelEmptyText->setVisible(true); m_labelEmptyText->setVisible(true);
m_tableWidget->horizontalHeader()->setVisible(false);
} }
}); });
deleteDialog->exec(); deleteDialog->exec();

View File

@ -167,9 +167,11 @@ void SelectRestorePoint::insertLines(const QList<ParseBackupList::BackupPoint> &
if (0 < indexOfRow) { if (0 < indexOfRow) {
m_tableWidget->setSortingEnabled(true); // 等录入完数据后再排序 m_tableWidget->setSortingEnabled(true); // 等录入完数据后再排序
m_tableWidget->sortItems(Column_Index::Backup_Time, Qt::DescendingOrder); m_tableWidget->sortItems(Column_Index::Backup_Time, Qt::DescendingOrder);
m_tableWidget->horizontalHeader()->setVisible(true);
} else { } else {
m_labelEmpty->setVisible(true); m_labelEmpty->setVisible(true);
m_labelEmptyText->setVisible(true); m_labelEmptyText->setVisible(true);
m_tableWidget->horizontalHeader()->setVisible(false);
} }
} }