OGS
ModelTreeItem Class Reference

Detailed Description

A TreeItem containing some additional information used in the StationModel.

See also
TreeItem

Definition at line 16 of file ModelTreeItem.h.

#include <ModelTreeItem.h>

Inheritance diagram for ModelTreeItem:
[legend]
Collaboration diagram for ModelTreeItem:
[legend]

Public Member Functions

 ModelTreeItem (const QList< QVariant > &data, TreeItem *parent, BaseItem *item=nullptr)
 ~ModelTreeItem () override
GeoLib::StationgetStation ()
 Returns the station object from which this item has been constructed.
BaseItemgetItem () const
 Returns the BaseItem associated with this item.
void setStation (GeoLib::Station *stn)
 Associates a station object with this item.
void setItem (BaseItem *item)
 Associates a BaseItem with this item.
Public Member Functions inherited from TreeItem
 TreeItem (QList< QVariant > data, TreeItem *parent)
virtual ~TreeItem ()
void appendChild (TreeItem *item)
TreeItemchild (int row) const
virtual int childCount () const
virtual int columnCount () const
virtual QVariant data (int column) const
virtual bool setData (int column, const QVariant &value)
int row () const
TreeItemparentItem () const
bool removeChildren (int position, int count)

Private Attributes

BaseItem_item
GeoLib::Station_stn

Constructor & Destructor Documentation

◆ ModelTreeItem()

ModelTreeItem::ModelTreeItem ( const QList< QVariant > & data,
TreeItem * parent,
BaseItem * item = nullptr )

Constructor

Parameters
dataThe data associated with each column
parentThe parent item in the tree
itemThe ModelItem-object

Definition at line 6 of file ModelTreeItem.cpp.

8 : TreeItem(data, parent), _item(item), _stn(nullptr)
9{
10}
BaseItem * _item
GeoLib::Station * _stn
TreeItem(QList< QVariant > data, TreeItem *parent)
Definition TreeItem.cpp:12
virtual QVariant data(int column) const
Definition TreeItem.cpp:83

References TreeItem::TreeItem(), _item, _stn, and TreeItem::data().

◆ ~ModelTreeItem()

ModelTreeItem::~ModelTreeItem ( )
inlineoverride

Definition at line 27 of file ModelTreeItem.h.

27{ delete _item; }

References _item.

Member Function Documentation

◆ getItem()

BaseItem * ModelTreeItem::getItem ( ) const

Returns the BaseItem associated with this item.

Definition at line 12 of file ModelTreeItem.cpp.

13{
14 if (_item != nullptr)
15 {
16 return _item;
17 }
18 return nullptr;
19}

References _item.

◆ getStation()

GeoLib::Station * ModelTreeItem::getStation ( )
inline

Returns the station object from which this item has been constructed.

Definition at line 29 of file ModelTreeItem.h.

29{ return _stn; }

References _stn.

◆ setItem()

void ModelTreeItem::setItem ( BaseItem * item)
inline

Associates a BaseItem with this item.

Definition at line 38 of file ModelTreeItem.h.

38{ _item = item; }

References _item.

◆ setStation()

void ModelTreeItem::setStation ( GeoLib::Station * stn)
inline

Associates a station object with this item.

Definition at line 35 of file ModelTreeItem.h.

35{ _stn = stn; }

References _stn.

Member Data Documentation

◆ _item

BaseItem* ModelTreeItem::_item
private

Definition at line 41 of file ModelTreeItem.h.

Referenced by ModelTreeItem(), ~ModelTreeItem(), getItem(), and setItem().

◆ _stn

GeoLib::Station* ModelTreeItem::_stn
private

Definition at line 42 of file ModelTreeItem.h.

Referenced by ModelTreeItem(), getStation(), and setStation().


The documentation for this class was generated from the following files: