LCOV - code coverage report
Current view: top level - dbe/apps/SchemaEditor - SchemaCustomModelInterface.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 38 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 8 0

            Line data    Source code
       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
       5              : // apps/SchemaEditor/SchemaCustomModelInterface.cpp).
       6              : 
       7              : /// Including Schema Editor
       8              : #include "dbe/SchemaCustomModelInterface.hpp"
       9              : #include "dbe/SchemaKernelWrapper.hpp"
      10              : #include "dbe/SchemaStyle.hpp"
      11              : 
      12            0 : dbse::CustomModelInterface::CustomModelInterface(QStringList Headers, QObject* parent)
      13              :   : QAbstractTableModel(parent)
      14            0 :   , HeaderList(Headers)
      15              : {
      16            0 : }
      17              : 
      18            0 : dbse::CustomModelInterface::~CustomModelInterface() {}
      19              : 
      20              : int
      21            0 : dbse::CustomModelInterface::rowCount(const QModelIndex& parent) const
      22              : {
      23            0 :   Q_UNUSED(parent)
      24            0 :   return Data.size();
      25              : }
      26              : 
      27              : int
      28            0 : dbse::CustomModelInterface::columnCount(const QModelIndex& parent) const
      29              : {
      30            0 :   Q_UNUSED(parent)
      31            0 :   return HeaderList.size();
      32              : }
      33              : 
      34              : Qt::ItemFlags
      35            0 : dbse::CustomModelInterface::flags(const QModelIndex& index) const
      36              : {
      37            0 :   Q_UNUSED(index)
      38            0 :   return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
      39              : }
      40              : 
      41              : QVariant
      42            0 : dbse::CustomModelInterface::headerData(int section, Qt::Orientation orientation, int role) const
      43              : {
      44            0 :   if (role != Qt::DisplayRole) {
      45            0 :     return QVariant();
      46              :   }
      47              : 
      48            0 :   if (orientation == Qt::Horizontal) {
      49            0 :     return HeaderList.at(section);
      50              :   }
      51              : 
      52            0 :   return QVariant();
      53              : }
      54              : 
      55              : QVariant
      56            0 : dbse::CustomModelInterface::data(const QModelIndex& index, int role) const
      57              : {
      58            0 :   if (role == Qt::DisplayRole) {
      59            0 :     return Data.value(index.row()).value(index.column());
      60            0 :   } else if (role == Qt::ForegroundRole) {
      61            0 :     auto row = Data.at(index.row());
      62            0 :     auto flag = row.at(row.size() - 1);
      63            0 :     if (flag == "I") {
      64            0 :       return SchemaStyle::get_color("foreground", "inherited");
      65              :     }
      66            0 :   } else if (role == Qt::BackgroundRole) {
      67            0 :     auto row = Data.at(index.row());
      68            0 :     auto flag = row.at(row.size() - 1);
      69            0 :     if (flag == "I") {
      70            0 :       return SchemaStyle::get_color("background", "inherited");
      71              :     }
      72            0 :   }
      73            0 :   return QVariant();
      74              : }
      75              : 
      76              : QStringList
      77            0 : dbse::CustomModelInterface::getRowFromIndex(QModelIndex& index)
      78              : {
      79            0 :   if (!index.isValid()) {
      80            0 :     return QStringList();
      81              :   }
      82              : 
      83            0 :   return Data.at(index.row());
      84              : }
        

Generated by: LCOV version 2.0-1