10 : QAbstractTableModel ( parent ),
11 HeaderList ( Headers )
29 return HeaderList.size();
35 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
41 if ( role != Qt::DisplayRole )
46 if ( orientation == Qt::Horizontal )
48 return HeaderList.at ( section );
56 if ( role == Qt::DisplayRole )
58 return m_data.value ( index.row() ).value ( index.column() );
60 if ( role == Qt::ToolTipRole )
62 return m_tooltips.value ( index.row() ).value ( index.column() );
64 if (role == Qt::ForegroundRole) {
65 return m_brushes.at(index.row());
67 if (role == Qt::BackgroundRole) {
68 return m_backgrounds.at(index.row());
76 if ( !index.isValid() )
81 return m_data.at ( index.row() );
86 std::vector<OksClass *> ClassList;
89 for (
unsigned int i = 0; i < ClassList.size(); ++i )
92 OksClass * Class = ClassList.at ( i );
93 Row.append ( QString ( Class->
get_name().c_str() ) );
94 m_data.append ( Row );
95 m_tooltips.append (QStringList {QString ( Class->
get_description().c_str() )});
116 types <<
"application/vnd.text.list";
122 QMimeData * mimeData =
new QMimeData();
123 QByteArray encodedData;
125 QDataStream stream ( &encodedData, QIODevice::WriteOnly );
127 foreach ( QModelIndex index, indexes )
129 if ( index.isValid() && index.column() == 0 )
131 QString ClassName = data ( index, Qt::DisplayRole ).toString();
136 mimeData->setData (
"application/vnd.text.list", encodedData );
int rowCount(const QModelIndex &parent) const
QMimeData * mimeData(const QModelIndexList &indexes) const
QVariant data(const QModelIndex &index, int role) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
CustomTableModel(QStringList Headers, QObject *parent=nullptr)
int columnCount(const QModelIndex &parent) const
QStringList mimeTypes() const
Drag/Drop Handlers.
Qt::ItemFlags flags(const QModelIndex &index) const
QStringList getRowFromIndex(QModelIndex &index)
static KernelWrapper & GetInstance()
void GetClassList(std::vector< dunedaq::oks::OksClass * > &ClassList) const
const std::string & get_name() const noexcept
const std::string & get_description() const noexcept
OksFile * get_file() const noexcept
const std::string & get_full_file_name() const
static QColor get_color(const QString &item, const QString &group)