Mantid
|
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... | |
RepoItem * | child (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... | |
RepoItem * | parent () 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 RepoItem & | operator= (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... | |
RepoItem * | parentItem |
the parent of this entry More... | |
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.
RepoModel::RepoItem::RepoItem | ( | QString | label, |
QString | path = "/" , |
||
RepoItem * | parent = nullptr |
||
) |
Definition at line 100 of file RepoModel.cpp.
RepoModel::RepoItem::~RepoItem | ( | ) |
destruct all the childItems.
Definition at line 103 of file RepoModel.cpp.
|
private |
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().
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.
row | Number between 0 and RepoModel::childCount(). |
Definition at line 120 of file RepoModel.cpp.
Referenced by MantidQt::API::RepoModel::index().
int RepoModel::RepoItem::childCount | ( | ) | const |
Return the number of children that this entry may find.
Definition at line 125 of file RepoModel.cpp.
Referenced by MantidQt::API::RepoModel::rowCount().
|
inline |
access to the label provided at construction
Definition at line 106 of file RepoModel.h.
|
inline |
access to the parent of this entry
Definition at line 109 of file RepoModel.h.
Referenced by MantidQt::API::RepoModel::parent().
|
inline |
access to the script repository path
Definition at line 103 of file RepoModel.h.
Referenced by MantidQt::API::RepoModel::data(), MantidQt::API::RepoModel::getParent(), MantidQt::API::RepoModel::isDownloading(), MantidQt::API::RepoModel::isUploading(), and MantidQt::API::RepoModel::setData().
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.
int RepoModel::RepoItem::row | ( | ) | const |
To which row this repoItem belongs?
Provide the row number of this entry related to its parent.
Definition at line 129 of file RepoModel.cpp.
Referenced by MantidQt::API::RepoModel::parent().
track the list of children for this entry
Definition at line 115 of file RepoModel.h.
|
private |
the path of the script repository
Definition at line 119 of file RepoModel.h.
|
private |
the label of this entry
Definition at line 117 of file RepoModel.h.
|
private |
the parent of this entry
Definition at line 121 of file RepoModel.h.