---
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
|
||||
#include "ui_RecordQuery.h"
|
||||
|
||||
using namespace sqlite_orm;
|
||||
|
||||
RecordQuery::RecordQuery(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::RecordQuery)
|
||||
@@ -71,8 +69,13 @@ void RecordQuery::UpdateRecordList(const std::vector<DbRecord>& records){
|
||||
int rowCount = int(records.size());
|
||||
ui->tblRecordList->setRowCount(rowCount); // 设置行数
|
||||
ui->tblRecordList->setColumnCount(column_labels.size()); // 设置列数
|
||||
// 设置水平表头
|
||||
// 设置水平表头
|
||||
ui->tblRecordList->setHorizontalHeaderLabels(column_labels);
|
||||
QStringList row_labels;
|
||||
for(int i = 0 ;i < records.size(); ++i){
|
||||
row_labels << QString::asprintf("%d",m_currentPageIndex*m_limit + i+1);
|
||||
}
|
||||
ui->tblRecordList->setVerticalHeaderLabels(row_labels);
|
||||
// 设置垂直表头
|
||||
// self.ui.tblTestList.setVerticalHeaderLabels([str(v) for v in
|
||||
// range(1,len(self.test_list)+1)]) 设置列宽
|
||||
@@ -242,7 +245,6 @@ void RecordQuery::on_btnQuery_clicked()
|
||||
count = (*i).get<int64_t>(0);
|
||||
}
|
||||
m_currentPageIndex = 0;
|
||||
//m_maxPageIndex
|
||||
if(count == 0){
|
||||
m_maxPageIndex = 1;
|
||||
}else{
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <sqlite_orm/sqlite_orm.h>
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "sqlite3pp.h"
|
||||
|
||||
@@ -101,7 +100,7 @@ private:
|
||||
std::shared_ptr<sqlite3pp::database> m_db;
|
||||
int m_currentPageIndex = 0;
|
||||
int m_maxPageIndex = 0;
|
||||
int m_limit = 2;
|
||||
int m_limit = 30;
|
||||
};
|
||||
|
||||
#endif // RECORDQUERY_H
|
||||
|
||||
@@ -243,9 +243,9 @@ void MainWindow::UpdateMessageList() {
|
||||
// 读取状态
|
||||
auto item = new QTableWidgetItem(r.isUnread ? "未读" : "已读");
|
||||
item->setTextAlignment(Qt::AlignCenter);
|
||||
// if(r.isUnread){
|
||||
// item->setForeground(Qt::blue);
|
||||
// }
|
||||
if(r.isUnread){
|
||||
item->setBackground(Qt::cyan);
|
||||
}
|
||||
ui->tblMessageList->setItem(rowIndex, column_index, item);
|
||||
column_index = column_index + 1;
|
||||
// 开始时间
|
||||
@@ -270,6 +270,7 @@ void MainWindow::UpdateMessageList() {
|
||||
column_index = column_index + 1;
|
||||
// 消息内容
|
||||
item = new QTableWidgetItem(r.content);
|
||||
item->setToolTip(r.content);
|
||||
ui->tblMessageList->setItem(rowIndex, column_index, item);
|
||||
column_index = column_index + 1;
|
||||
|
||||
@@ -377,6 +378,7 @@ void MainWindow::on_tblMessageList_currentItemChanged(QTableWidgetItem *current,
|
||||
if(m_msgList[currentRow].isUnread){
|
||||
m_msgList[currentRow].isUnread = true;
|
||||
ui->tblMessageList->item(currentRow,0)->setText("已读");
|
||||
ui->tblMessageList->item(currentRow,0)->setBackground(Qt::white);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user