Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MantidQt::API::RepoModel::RepoItem Class Reference

A nested class to help RepoModel to implement the QAbstractItemModel. More...

Public Member Functions

void appendChild (RepoItem *child)
 This method is the very responsible to allow the reconstruction of the hierarchical tree, keeping track of the children of one item. More...
 
RepoItemchild (int row) const
 Gives access to the row_th children of RepoItem. More...
 
int childCount () const
 Return the number of children that this entry may find. More...
 
const QString & label () const
 access to the label provided at construction More...
 
RepoItemparent () const
 access to the parent of this entry More...
 
const QString & path () const
 access to the script repository path More...
 
bool removeChild (int row)
 allow to remove a child, which allows erasing rows from the view. More...
 
 RepoItem (QString label, QString path="/", RepoItem *parent=nullptr)
 
int row () const
 To which row this repoItem belongs? More...
 
 ~RepoItem ()
 destruct all the childItems. More...
 

Private Member Functions

const RepoItemoperator= (const RepoItem &)
 
 RepoItem (const RepoItem &)
 

Private Attributes

QList< RepoItem * > childItems
 track the list of children for this entry More...
 
QString keypath
 the path of the script repository More...
 
QString m_label
 the label of this entry More...
 
RepoItemparentItem
 the parent of this entry More...
 

Detailed Description

A nested class to help RepoModel to implement the QAbstractItemModel.

This class in indended to keep track of the path inside the Repository of the entries, in such a way the repomodel will be able to get from the index the path. The RepoModel::appendChild allows the RepoModel to reconstruct the tree of the directories, while the RepoModel::child and RepoModel::parent methods allow to iterate over the tree.

Definition at line 87 of file RepoModel.h.

Constructor & Destructor Documentation

◆ RepoItem() [1/2]

RepoModel::RepoItem::RepoItem ( QString  label,
QString  path = "/",
RepoItem parent = nullptr 
)

Definition at line 100 of file RepoModel.cpp.

◆ ~RepoItem()

RepoModel::RepoItem::~RepoItem ( )

destruct all the childItems.

Definition at line 103 of file RepoModel.cpp.

◆ RepoItem() [2/2]

MantidQt::API::RepoModel::RepoItem::RepoItem ( const RepoItem )
private

Member Function Documentation

◆ appendChild()

void RepoModel::RepoItem::appendChild ( RepoItem child)

This method is the very responsible to allow the reconstruction of the hierarchical tree, keeping track of the children of one item.

Definition at line 107 of file RepoModel.cpp.

Referenced by MantidQt::API::RepoModel::getParent().

◆ child()

RepoModel::RepoItem * RepoModel::RepoItem::child ( int  row) const

Gives access to the row_th children of RepoItem.

Note that the row can not be greater than RepoModel::childCount().

But we do not test it, because this method will be called indirectly from the QView, and will never go beyond that value.

Parameters
rowNumber between 0 and RepoModel::childCount().
Returns
The pointer to the row_th children.

Definition at line 120 of file RepoModel.cpp.

Referenced by MantidQt::API::RepoModel::index().

◆ childCount()

int RepoModel::RepoItem::childCount ( ) const

Return the number of children that this entry may find.

Returns
Number of children

Definition at line 125 of file RepoModel.cpp.

Referenced by MantidQt::API::RepoModel::rowCount().

◆ label()

const QString & MantidQt::API::RepoModel::RepoItem::label ( ) const
inline

access to the label provided at construction

Returns
: label for this entry

Definition at line 106 of file RepoModel.h.

◆ operator=()

const RepoItem & MantidQt::API::RepoModel::RepoItem::operator= ( const RepoItem )
private

◆ parent()

RepoItem * MantidQt::API::RepoModel::RepoItem::parent ( ) const
inline

access to the parent of this entry

Returns
: this entry parent's

Definition at line 109 of file RepoModel.h.

Referenced by MantidQt::API::RepoModel::parent().

◆ path()

const QString & MantidQt::API::RepoModel::RepoItem::path ( ) const
inline

◆ removeChild()

bool RepoModel::RepoItem::removeChild ( int  row)

allow to remove a child, which allows erasing rows from the view.

Remove the given child from the childItems.

Used to allow removing rows from the view

Definition at line 136 of file RepoModel.cpp.

◆ row()

int RepoModel::RepoItem::row ( ) const

To which row this repoItem belongs?

Provide the row number of this entry related to its parent.

Returns
It's child position.

Definition at line 129 of file RepoModel.cpp.

Referenced by MantidQt::API::RepoModel::parent().

Member Data Documentation

◆ childItems

QList<RepoItem *> MantidQt::API::RepoModel::RepoItem::childItems
private

track the list of children for this entry

Definition at line 115 of file RepoModel.h.

◆ keypath

QString MantidQt::API::RepoModel::RepoItem::keypath
private

the path of the script repository

Definition at line 119 of file RepoModel.h.

◆ m_label

QString MantidQt::API::RepoModel::RepoItem::m_label
private

the label of this entry

Definition at line 117 of file RepoModel.h.

◆ parentItem

RepoItem* MantidQt::API::RepoModel::RepoItem::parentItem
private

the parent of this entry

Definition at line 121 of file RepoModel.h.


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