-
Notifications
You must be signed in to change notification settings - Fork 0
/
sourceview.h
78 lines (62 loc) · 2 KB
/
sourceview.h
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
68
69
70
71
72
73
74
75
76
77
78
#ifndef DIALOGSOURCEVIEW_H
#define DIALOGSOURCEVIEW_H
#include <QDialog>
#include "ui_sourceview.h"
#include <QMessageBox>
#include <QSortFilterProxyModel>
#include <QCheckBox>
#include <QSignalMapper>
class SourceTableModel;
class SourceProxyModel;
class Sourceview : public QDialog, public Ui::sourceview
{
Q_OBJECT
private:
int getId();
QCheckBox * uiDelete;
QSignalMapper * deleteMapper;
public:
Sourceview(QWidget* = 0);
SourceTableModel* personModel;
SourceProxyModel* proxyModel;
bool acceptRow(int row);
bool showMales, showFemales;
private slots:
void slotSelection();
void slotUpdate();
void slotClose();
void updateBegin();
void slotAddNew();
void slotDelete(int id);
signals:
void sigUpdate(quint16);
};
class SourceProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
private:
SourceTableModel* personModel;
Sourceview* p;
public:
SourceProxyModel(SourceTableModel* pm, Sourceview *parent=0) : QSortFilterProxyModel(parent) { p = parent ; personModel = pm; }
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
};
class SourceTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
SourceTableModel(QObject *parent=0) : QAbstractTableModel(parent) { koe=0; }
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
private:
int koe;
public slots:
void slotUpdate();
void updateBegin();
};
#endif // DIALOGSOURCEVIEW_H