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 15 of file SchemaCustomModelInterface.hpp.

Constructor & Destructor Documentation

◆ CustomModelInterface()

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

Including Schema Editor.

Definition at line 12 of file SchemaCustomModelInterface.cpp.

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

◆ ~CustomModelInterface()

dbse::CustomModelInterface::~CustomModelInterface ( )

Definition at line 18 of file SchemaCustomModelInterface.cpp.

18{}

Member Function Documentation

◆ columnCount()

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

Definition at line 28 of file SchemaCustomModelInterface.cpp.

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

◆ data()

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

Definition at line 56 of file SchemaCustomModelInterface.cpp.

57{
58 if (role == Qt::DisplayRole) {
59 return Data.value(index.row()).value(index.column());
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 } else if (role == Qt::BackgroundRole) {
67 auto row = Data.at(index.row());
68 auto flag = row.at(row.size() - 1);
69 if (flag == "I") {
70 return SchemaStyle::get_color("background", "inherited");
71 }
72 }
73 return QVariant();
74}
static QColor get_color(const QString &item, const QString &group)

◆ flags()

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

Definition at line 35 of file SchemaCustomModelInterface.cpp.

36{
37 Q_UNUSED(index)
38 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
39}

◆ getRowFromIndex()

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

Definition at line 77 of file SchemaCustomModelInterface.cpp.

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

◆ headerData()

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

Definition at line 42 of file SchemaCustomModelInterface.cpp.

43{
44 if (role != Qt::DisplayRole) {
45 return QVariant();
46 }
47
48 if (orientation == Qt::Horizontal) {
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: