COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
PropertyModel Class Reference

Model that maintains properties for the node pointed by the index returned by NTree::global()->currentIndex(). This class is a view for the tree model and is automatically updated whenever the current index is changed. More...

#include <PropertyModel.hpp>

Inherits QAbstractItemModel.

Public Member Functions

 PropertyModel ()
 Constructor. More...
 
virtual QVariant data (const QModelIndex &index, int role) const
 Destructor. More...
 
virtual QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 Implementation of QAbstractItemModel::index(). More...
 
virtual QModelIndex parent (const QModelIndex &child) const
 Implementation of QAbstractItemModel::parent()-> More...
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 Implementation of QAbstractItemModel::rowCount(). More...
 
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 Implementation of QAbstractItemModel::columnCount(). More...
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Gives header titles. More...
 

Private Slots

void current_index_changed (const QModelIndex &newIndex, const QModelIndex &oldIndex)
 Slot called when the current index has changed in the tree model. More...
 

Private Member Functions

void empty_list ()
 Clean the model data. More...
 

Private Attributes

QList< PropertyItem * > m_data
 Model data. More...
 
QStringList m_columns
 List of column headers. More...
 

Detailed Description

Model that maintains properties for the node pointed by the index returned by NTree::global()->currentIndex(). This class is a view for the tree model and is automatically updated whenever the current index is changed.

Author
Quentin Gasper.

Definition at line 53 of file PropertyModel.hpp.

Constructor & Destructor Documentation

Constructor.

Definition at line 19 of file PropertyModel.cpp.

Member Function Documentation

int columnCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Implementation of QAbstractItemModel::columnCount().

Returns
Always returns 1.

Definition at line 99 of file PropertyModel.cpp.

void current_index_changed ( const QModelIndex &  newIndex,
const QModelIndex &  oldIndex 
)
privateslot

Slot called when the current index has changed in the tree model.

Parameters
newIndexNew current index.
oldIndexOld current index.

Definition at line 118 of file PropertyModel.cpp.

QVariant data ( const QModelIndex &  index,
int  role 
) const
virtual

Destructor.

Frees all allocated memory. Implementation of QAbstractItemModel::data(). Only the role Qt::DisplayRole is accepted. Other roles will result to the return of an empty QVariant object (built with the default construtor).

Parameters
indexConcerned item index.
roleRole of the returned value (only Qt::DisplayRole).
Returns
Returns an empty QVariant object if the role is not Qt::DecorationRole or if the index is not valid. Otherwise, returns the nodename of the item at the specified index.

Definition at line 39 of file PropertyModel.cpp.

void empty_list ( )
private

Clean the model data.

Definition at line 141 of file PropertyModel.cpp.

QVariant headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual

Gives header titles.

Overrides QAbstractItemModel::headerData().

Parameters
sectionSection number.
orientationHeader orientation.
roleData role. Only Qt::DisplayRole is accepted.
Returns
Returns the data or an empty QVariant on error.

Definition at line 106 of file PropertyModel.cpp.

QModelIndex index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
virtual

Implementation of QAbstractItemModel::index().

Gives the index of the item at the given row and column under the given parent. If the parent index is not valid, the root item is taken as parent.

Parameters
rowItem row from the parent.
columnItem column.
parentItem parent.
Returns
Returns the requested index, or a nullptr index if hasIndex(row, column, parent) returns false.

Definition at line 63 of file PropertyModel.cpp.

QModelIndex parent ( const QModelIndex &  child) const
virtual

Implementation of QAbstractItemModel::parent()->

Parameters
childItem index of which we would like to know the parent.
Returns
Returns the parent index of the given child or a nullptr index if the child is not a valid index.

Definition at line 82 of file PropertyModel.cpp.

int rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Implementation of QAbstractItemModel::rowCount().

If the parent index is not valid, the root item is taken as parent.

Returns
Returns the row count (number of children) of a given parent.

Definition at line 89 of file PropertyModel.cpp.

Member Data Documentation

QStringList m_columns
private

List of column headers.

Definition at line 134 of file PropertyModel.hpp.

QList<PropertyItem *> m_data
private

Model data.

Definition at line 131 of file PropertyModel.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin