OGS
ModelTreeItem Class Reference

Detailed Description

A TreeItem containing some additional information used in the StationModel.

See also
TreeItem

Definition at line 27 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 17 of file ModelTreeItem.cpp.

19 : TreeItem(data, parent), _item(item), _stn(nullptr)
20{
21}
BaseItem * _item
GeoLib::Station * _stn
TreeItem(QList< QVariant > data, TreeItem *parent)
Definition TreeItem.cpp:23
virtual QVariant data(int column) const
Definition TreeItem.cpp:94

◆ ~ModelTreeItem()

ModelTreeItem::~ModelTreeItem ( )
inlineoverride

Definition at line 38 of file ModelTreeItem.h.

38{ delete _item; }

References _item.

Member Function Documentation

◆ getItem()

BaseItem * ModelTreeItem::getItem ( ) const

Returns the BaseItem associated with this item.

Definition at line 23 of file ModelTreeItem.cpp.

24{
25 if (_item != nullptr)
26 {
27 return _item;
28 }
29 return nullptr;
30}

References _item.

◆ getStation()

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

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

Definition at line 40 of file ModelTreeItem.h.

40{ return _stn; }

References _stn.

◆ setItem()

void ModelTreeItem::setItem ( BaseItem * item)
inline

Associates a BaseItem with this item.

Definition at line 49 of file ModelTreeItem.h.

49{ _item = item; }

References _item.

◆ setStation()

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

Associates a station object with this item.

Definition at line 46 of file ModelTreeItem.h.

46{ _stn = stn; }

References _stn.

Member Data Documentation

◆ _item

BaseItem* ModelTreeItem::_item
private

Definition at line 52 of file ModelTreeItem.h.

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

◆ _stn

GeoLib::Station* ModelTreeItem::_stn
private

Definition at line 53 of file ModelTreeItem.h.

Referenced by getStation(), and setStation().


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