DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbse::CustomModelInterface Class Referenceabstract

#include <SchemaCustomModelInterface.hpp>

Inheritance diagram for dbse::CustomModelInterface:
[legend]
Collaboration diagram for dbse::CustomModelInterface:
[legend]

Public Member Functions

 CustomModelInterface (QStringList Headers, QObject *parent=nullptr)
 Including Schema Editor.
 ~CustomModelInterface ()
int rowCount (const QModelIndex &parent) const
int columnCount (const QModelIndex &parent) const
Qt::ItemFlags flags (const QModelIndex &index) const
QVariant headerData (int section, Qt::Orientation orientation, int role) const
QVariant data (const QModelIndex &index, int role) const
QStringList getRowFromIndex (QModelIndex &index)
virtual void setupModel ()=0

Protected Attributes

QStringList HeaderList
QList< QStringList > Data

Detailed Description

Definition at line 16 of file SchemaCustomModelInterface.hpp.

Constructor & Destructor Documentation

◆ CustomModelInterface()

dbse::CustomModelInterface::CustomModelInterface ( QStringList Headers,
QObject * parent = nullptr )
explicit

Including Schema Editor.

Definition at line 11 of file SchemaCustomModelInterface.cpp.

12 : QAbstractTableModel ( parent ),
13 HeaderList ( Headers )
14{
15}

◆ ~CustomModelInterface()

dbse::CustomModelInterface::~CustomModelInterface ( )

Definition at line 17 of file SchemaCustomModelInterface.cpp.

18{
19}

Member Function Documentation

◆ columnCount()

int dbse::CustomModelInterface::columnCount ( const QModelIndex & parent) const

Definition at line 27 of file SchemaCustomModelInterface.cpp.

28{
29 Q_UNUSED ( parent )
30 return HeaderList.size();
31}

◆ data()

QVariant dbse::CustomModelInterface::data ( const QModelIndex & index,
int role ) const

Definition at line 55 of file SchemaCustomModelInterface.cpp.

56{
57 if ( role == Qt::DisplayRole ) {
58 return Data.value ( index.row() ).value ( index.column() );
59 }
60 else if (role == Qt::ForegroundRole) {
61 auto row = Data.at(index.row());
62 auto flag = row.at(row.size()-1);
63 if (flag == "I") {
64 return SchemaStyle::get_color("foreground", "inherited");
65 }
66 }
67 else if (role == Qt::BackgroundRole) {
68 auto row = Data.at(index.row());
69 auto flag = row.at(row.size()-1);
70 if (flag == "I") {
71 return SchemaStyle::get_color("background", "inherited");
72 }
73 }
74 return QVariant();
75}
static QColor get_color(const QString &item, const QString &group)

◆ flags()

Qt::ItemFlags dbse::CustomModelInterface::flags ( const QModelIndex & index) const

Definition at line 33 of file SchemaCustomModelInterface.cpp.

34{
35 Q_UNUSED ( index )
36 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
37}

◆ getRowFromIndex()

QStringList dbse::CustomModelInterface::getRowFromIndex ( QModelIndex & index)

Definition at line 77 of file SchemaCustomModelInterface.cpp.

78{
79 if ( !index.isValid() )
80 {
81 return QStringList();
82 }
83
84 return Data.at ( index.row() );
85}

◆ headerData()

QVariant dbse::CustomModelInterface::headerData ( int section,
Qt::Orientation orientation,
int role ) const

Definition at line 39 of file SchemaCustomModelInterface.cpp.

41{
42 if ( role != Qt::DisplayRole )
43 {
44 return QVariant();
45 }
46
47 if ( orientation == Qt::Horizontal )
48 {
49 return HeaderList.at ( section );
50 }
51
52 return QVariant();
53}

◆ rowCount()

int dbse::CustomModelInterface::rowCount ( const QModelIndex & parent) const

Definition at line 21 of file SchemaCustomModelInterface.cpp.

22{
23 Q_UNUSED ( parent )
24 return Data.size();
25}

◆ setupModel()

Member Data Documentation

◆ Data

QList<QStringList> dbse::CustomModelInterface::Data
protected

Definition at line 31 of file SchemaCustomModelInterface.hpp.

◆ HeaderList

QStringList dbse::CustomModelInterface::HeaderList
protected

Definition at line 30 of file SchemaCustomModelInterface.hpp.


The documentation for this class was generated from the following files: