Line data Source code
1 : /// Including Schema Editor
2 : #include "dbe/SchemaCustomModelInterface.hpp"
3 : #include "dbe/SchemaKernelWrapper.hpp"
4 :
5 0 : dbse::CustomModelInterface::CustomModelInterface ( QStringList Headers, QObject * parent )
6 : : QAbstractTableModel ( parent ),
7 0 : HeaderList ( Headers )
8 : {
9 0 : }
10 :
11 0 : dbse::CustomModelInterface::~CustomModelInterface()
12 : {
13 0 : }
14 :
15 0 : int dbse::CustomModelInterface::rowCount ( const QModelIndex & parent ) const
16 : {
17 0 : Q_UNUSED ( parent )
18 0 : return Data.size();
19 : }
20 :
21 0 : int dbse::CustomModelInterface::columnCount ( const QModelIndex & parent ) const
22 : {
23 0 : Q_UNUSED ( parent )
24 0 : return HeaderList.size();
25 : }
26 :
27 0 : Qt::ItemFlags dbse::CustomModelInterface::flags ( const QModelIndex & index ) const
28 : {
29 0 : Q_UNUSED ( index )
30 0 : return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
31 : }
32 :
33 0 : QVariant dbse::CustomModelInterface::headerData ( int section, Qt::Orientation orientation,
34 : int role ) const
35 : {
36 0 : if ( role != Qt::DisplayRole )
37 : {
38 0 : return QVariant();
39 : }
40 :
41 0 : if ( orientation == Qt::Horizontal )
42 : {
43 0 : return HeaderList.at ( section );
44 : }
45 :
46 0 : return QVariant();
47 : }
48 :
49 0 : QVariant dbse::CustomModelInterface::data ( const QModelIndex & index, int role ) const
50 : {
51 0 : if ( role != Qt::DisplayRole )
52 : {
53 0 : return QVariant();
54 : }
55 :
56 0 : return Data.value ( index.row() ).value ( index.column() );
57 : }
58 :
59 0 : QStringList dbse::CustomModelInterface::getRowFromIndex ( QModelIndex & index )
60 : {
61 0 : if ( !index.isValid() )
62 : {
63 0 : return QStringList();
64 : }
65 :
66 0 : return Data.at ( index.row() );
67 : }
|