ATLAS Offline Software
Public Slots | Public Member Functions | Private Attributes | List of all members
ZappedVolumeListModel Class Reference

#include <ZappedVolumeListModel.h>

Inheritance diagram for ZappedVolumeListModel:
Collaboration diagram for ZappedVolumeListModel:

Public Slots

void activated (const QModelIndex &)
 

Public Member Functions

 ZappedVolumeListModel (QObject *parent=0)
 
virtual ~ZappedVolumeListModel ()
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 
Qt::ItemFlags flags (const QModelIndex &index) const
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 
void addToZappedVolumes (VolumeHandle *)
 
void removeFromZappedVolumes (VolumeHandle *)
 

Private Attributes

QList< VolumeHandle * > m_zappedhandles
 

Detailed Description

Definition at line 15 of file ZappedVolumeListModel.h.

Constructor & Destructor Documentation

◆ ZappedVolumeListModel()

ZappedVolumeListModel::ZappedVolumeListModel ( QObject *  parent = 0)

Definition at line 8 of file ZappedVolumeListModel.cxx.

9  : QAbstractListModel(parent)
10 {
11 }

◆ ~ZappedVolumeListModel()

ZappedVolumeListModel::~ZappedVolumeListModel ( )
virtual

Definition at line 14 of file ZappedVolumeListModel.cxx.

15 {
16 }

Member Function Documentation

◆ activated

void ZappedVolumeListModel::activated ( const QModelIndex &  index)
slot

Definition at line 19 of file ZappedVolumeListModel.cxx.

20 {
21  m_zappedhandles.at(index.row())->setState(VP1GeoFlags::CONTRACTED);
22 }

◆ addToZappedVolumes()

void ZappedVolumeListModel::addToZappedVolumes ( VolumeHandle handle)
inline

Definition at line 61 of file ZappedVolumeListModel.h.

62 {
63  beginResetModel(); // see: http://doc.qt.io/qt-5/qabstractitemmodel-obsolete.html
64  m_zappedhandles << handle;
65  endResetModel();
66 }

◆ data()

QVariant ZappedVolumeListModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
inline

Definition at line 56 of file ZappedVolumeListModel.h.

57 {
58  return (role!=Qt::DisplayRole||!index.isValid()) ? QVariant() : m_zappedhandles.at(index.row())->getName();
59 }

◆ flags()

Qt::ItemFlags ZappedVolumeListModel::flags ( const QModelIndex &  index) const
inline

Definition at line 50 of file ZappedVolumeListModel.h.

51 {
52  return index.isValid() ? (Qt::ItemIsEnabled|Qt::ItemIsSelectable) : Qt::ItemFlags();
53 }

◆ removeFromZappedVolumes()

void ZappedVolumeListModel::removeFromZappedVolumes ( VolumeHandle handle)
inline

Definition at line 68 of file ZappedVolumeListModel.h.

69 {
70  beginResetModel();
71  m_zappedhandles.removeAll(handle);
72  endResetModel();
73 }

◆ rowCount()

int ZappedVolumeListModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
inline

Definition at line 45 of file ZappedVolumeListModel.h.

46 {
47  return parent.isValid() ? 0 : m_zappedhandles.count();
48 }

Member Data Documentation

◆ m_zappedhandles

QList<VolumeHandle*> ZappedVolumeListModel::m_zappedhandles
private

Definition at line 38 of file ZappedVolumeListModel.h.


The documentation for this class was generated from the following files:
query_example.row
row
Definition: query_example.py:24
ZappedVolumeListModel::m_zappedhandles
QList< VolumeHandle * > m_zappedhandles
Definition: ZappedVolumeListModel.h:38
index
Definition: index.py:1
dumpTruth.getName
getName
Definition: dumpTruth.py:34
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1GeoFlags::CONTRACTED
@ CONTRACTED
Definition: VP1GeoFlags.h:87