-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableOperaWidget.h
More file actions
52 lines (40 loc) · 1.24 KB
/
TableOperaWidget.h
File metadata and controls
52 lines (40 loc) · 1.24 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef TABLEOPERAWIDGET_H
#define TABLEOPERAWIDGET_H
#include <QWidget>
#include <QtSql>
#include <QDataWidgetMapper>
#include "theDB.h"
#include <QDataWidgetMapper>
#include <QObject>
#include <QByteArrayData>
namespace Ui {
class TableOperaWidget;
}
class TableOperaWidget : public QWidget
{
Q_OBJECT
public:
explicit TableOperaWidget(QWidget *parent = nullptr);
~TableOperaWidget();
private slots:
void on_currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
// QTableView的SelectionModel的行发生了变化,进行处理
void on_currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous);
void on_appendBtn_clicked();
void on_removeBtn_clicked();
void on_pixmap_changed(const QByteArray& ig);
private:
Ui::TableOperaWidget *ui;
QSqlTableModel tableModel = QSqlTableModel(this, *(theDB::instance()->getDataBase()));
QItemSelectionModel theSelection = QItemSelectionModel(&tableModel);
QDataWidgetMapper dataMapper;
private:
//私有工具函数
void init();
void SetTableModel();
void SetTableView();
void SetDataMapper();
//数据修改后得确认更改和更新显示数据表
void tableSubmitAndUpadate();
};
#endif // TABLEOPERAWIDGET_H