DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dbe
apps
SchemaEditor
SchemaCustomModelInterface.cpp
Go to the documentation of this file.
1
// DUNE DAQ modification notice:
2
// This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3
// Fork baseline commit: dbe-02-12-17 (2022-05-12).
4
// Renamed since fork: yes (from src/SchemaEditor/SchemaCustomModelInterface.cpp to apps/SchemaEditor/SchemaCustomModelInterface.cpp).
5
7
#include "
dbe/SchemaCustomModelInterface.hpp
"
8
#include "
dbe/SchemaKernelWrapper.hpp
"
9
#include "
dbe/SchemaStyle.hpp
"
10
11
dbse::CustomModelInterface::CustomModelInterface
( QStringList Headers, QObject * parent )
12
: QAbstractTableModel ( parent ),
13
HeaderList
( Headers )
14
{
15
}
16
17
dbse::CustomModelInterface::~CustomModelInterface
()
18
{
19
}
20
21
int
dbse::CustomModelInterface::rowCount
(
const
QModelIndex & parent )
const
22
{
23
Q_UNUSED ( parent )
24
return
Data
.size();
25
}
26
27
int
dbse::CustomModelInterface::columnCount
(
const
QModelIndex & parent )
const
28
{
29
Q_UNUSED ( parent )
30
return
HeaderList
.size();
31
}
32
33
Qt::ItemFlags
dbse::CustomModelInterface::flags
(
const
QModelIndex & index )
const
34
{
35
Q_UNUSED ( index )
36
return
Qt::ItemIsEnabled | Qt::ItemIsSelectable;
37
}
38
39
QVariant
dbse::CustomModelInterface::headerData
(
int
section, Qt::Orientation orientation,
40
int
role )
const
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
}
54
55
QVariant
dbse::CustomModelInterface::data
(
const
QModelIndex & index,
int
role )
const
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
}
76
77
QStringList
dbse::CustomModelInterface::getRowFromIndex
( QModelIndex & index )
78
{
79
if
( !index.isValid() )
80
{
81
return
QStringList();
82
}
83
84
return
Data
.at ( index.row() );
85
}
SchemaCustomModelInterface.hpp
SchemaKernelWrapper.hpp
SchemaStyle.hpp
dbse::CustomModelInterface::HeaderList
QStringList HeaderList
Definition
SchemaCustomModelInterface.hpp:30
dbse::CustomModelInterface::data
QVariant data(const QModelIndex &index, int role) const
Definition
SchemaCustomModelInterface.cpp:55
dbse::CustomModelInterface::rowCount
int rowCount(const QModelIndex &parent) const
Definition
SchemaCustomModelInterface.cpp:21
dbse::CustomModelInterface::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition
SchemaCustomModelInterface.cpp:39
dbse::CustomModelInterface::getRowFromIndex
QStringList getRowFromIndex(QModelIndex &index)
Definition
SchemaCustomModelInterface.cpp:77
dbse::CustomModelInterface::~CustomModelInterface
~CustomModelInterface()
Definition
SchemaCustomModelInterface.cpp:17
dbse::CustomModelInterface::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition
SchemaCustomModelInterface.cpp:33
dbse::CustomModelInterface::CustomModelInterface
CustomModelInterface(QStringList Headers, QObject *parent=nullptr)
Including Schema Editor.
Definition
SchemaCustomModelInterface.cpp:11
dbse::CustomModelInterface::columnCount
int columnCount(const QModelIndex &parent) const
Definition
SchemaCustomModelInterface.cpp:27
dbse::CustomModelInterface::Data
QList< QStringList > Data
Definition
SchemaCustomModelInterface.hpp:31
dbse::SchemaStyle::get_color
static QColor get_color(const QString &item, const QString &group)
Definition
SchemaStyle.cpp:103
Generated on
for DUNE-DAQ by
1.17.0