-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshowtablewidget.h
More file actions
67 lines (55 loc) · 1.65 KB
/
showtablewidget.h
File metadata and controls
67 lines (55 loc) · 1.65 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef SHOWTABLEWIDGET_H
#define SHOWTABLEWIDGET_H
#include <QWidget>
class QTableView;
class QSqlTableModel;
class QMenu;
class QToolBar;
class ShowTableObjects;
class QModelIndex;
class ShowTableWidget:public QWidget
{
Q_OBJECT
public:
static ShowTableWidget* createObject(const QString &table_name,const QString &con,bool &isExist);
static void deleteObject(const QString &table_name,const QString &con);
static void initObjContainer();
static void delObjContainer();
static QList<QWidget*>* dbTables(const QString &con);
static QList<ShowTableWidget*> allTables();
private slots:
void showContextMenu(QPoint p);
void appendRow();
void insertRow();
void removeSelectedRows();
void submit();
void dataChanged(const QModelIndex &topLeft,const QModelIndex &bottomRight);
void rowsInserted(const QModelIndex &parent, int start, int end);
void rowsRemoved(const QModelIndex &parent, int start, int end);
protected:
void closeEvent(QCloseEvent *event);
private:
ShowTableWidget();
void init(const QString &table_name,const QString &con);
void init_model();
void init_table();
//void init_actions();
void init_menu();
void init_toolbar();
bool maybeSave();
bool isDirty;
QTableView *view;
QMenu *contextMenu;
QSqlTableModel *model;
QString table;
QString dbname;
QString con;
QToolBar *toolbar;
QAction *removeAct;
QAction *insertAct;
QAction *appendAct;
QAction *submitAct;
QAction *cancelAct;
static ShowTableObjects *objs;
};
#endif // SHOWTABLEWIDGET_H