-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstatusview.cpp
40 lines (32 loc) · 996 Bytes
/
statusview.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "statusview.h"
#include <QHeaderView>
#include <QResizeEvent>
#include <QDebug>
#include "encryptlistmodel.h"
#include "mainwindow.h"
StatusView::StatusView(QWidget *parent):QTableView(parent)
{
setSelectionMode(QTableView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows);//设置选中模式为选中行
timerID = startTimer(100);
}
void StatusView::resizeEvent(QResizeEvent *event)
{
QTableView::resizeEvent(event);
setColumnWidth(1,100);
setColumnWidth(2,300);
horizontalHeader()->setSectionResizeMode(0,QHeaderView::Stretch);
}
void StatusView::timerEvent(QTimerEvent *event)
{
QTableView::timerEvent(event);
EncryptListModel* listmodel = dynamic_cast<EncryptListModel*>(model());
if(listmodel->status.size()<1) return;
if(listmodel)
listmodel->refresh();
foreach (const EncryptState& state, listmodel->status) {
if( !state.over )
return;
}
emit changeEnabled(true);
}