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

Model that handles modified options details. More...

#include <CommitDetails.hpp>

Inherits QAbstractItemModel.

Public Member Functions

 CommitDetails (QObject *parent=nullptr, const QString &node_path=QString())
 Constructor. More...
 
QVariant data (const QModelIndex &index, int role) const
 Implements QAbstractItemModel::data() More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Reimplements QAbstractItemModel::headerData() More...
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 Implements QAbstractItemModel::index() More...
 
QModelIndex parent (const QModelIndex &index) const
 Implements QAbstractItemModel::parent() More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Implements QAbstractItemModel::rowCount() More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Implements QAbstractItemModel::columnCount() More...
 
void set_option (const QString &optionName, const QString &oldValue, const QString &currentValue)
 Sets a option. More...
 
QString node_path () const
 Gives the node path. More...
 
void set_node_path (const QString &node_path)
 Sets the node path. More...
 
bool has_options () const
 Checks whether the internal container has options. More...
 
void clear ()
 Removes all options and clears the node path. More...
 

Private Attributes

QString m_node_path
 Node path. More...
 
QList< CommitDetailsItem * > m_items
 Model items. More...
 

Detailed Description

Model that handles modified options details.

It can be used in a view to show modified options, their old and current value. When a method takes as parameter a QModelIndex that can be null, the root is taken is this case.

Author
Quentin Gasper.

Definition at line 36 of file CommitDetails.hpp.

Constructor & Destructor Documentation

CommitDetails ( QObject *  parent = nullptr,
const QString &  node_path = QString() 
)

Constructor.

Parameters
parentThe parent object. May be nullptr.
node_pathPath to the node the options belong to. May be empty.

Definition at line 23 of file CommitDetails.cpp.

Member Function Documentation

void clear ( )

Removes all options and clears the node path.

See also
clearOptions

Definition at line 174 of file CommitDetails.cpp.

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

Implements QAbstractItemModel::columnCount()

Gives the number of columns for a specified index.

Parameters
parentThe index of which we want to know the column count.
Returns
Always returns 3.

Definition at line 151 of file CommitDetails.cpp.

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

Implements QAbstractItemModel::data()

Gives index data, depending on the provided role.

Parameters
indexThe index from which the data is wanted
roleRole of the wanted data. Available roles are defined by Qt::ItemDataRole enum. Qt::DisplayRole is the only role accepted.
Returnsthe wanted data, of an invalid QVariant (built with default constructor) if the index is not valid, or if the role is not supported.

Definition at line 31 of file CommitDetails.cpp.

bool has_options ( ) const

Checks whether the internal container has options.

Returns
Returns true if there is at least one option; otherwise returns false.

Definition at line 167 of file CommitDetails.cpp.

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

Reimplements QAbstractItemModel::headerData()

Gives header data for a specified column or row.

Parameters
sectionColumn or row number
orientationIndicates wether we want the row header or the column one.
roleRole of the wanted data. Available roles are defined by Qt::ItemDataRole enum. Qt::DisplayRole is the only role accepted.
Returns
Returns:
  • the column name if orientation is Qt::Horizontal
  • "Option #i", where 'i' is section + 1, if orientation is Qt::Vertical
  • an invalid QVariant (built with default constructor) if section is less than 0 or bigger than the number of columns or rows.

Definition at line 78 of file CommitDetails.cpp.

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

Implements QAbstractItemModel::index()

Builds an index for the wanted object

Parameters
rowRow
columnColumn
parentParent index, may be null.
Returns
Returns the built index, or a invalid index if either the row or the column is not valid.

Definition at line 113 of file CommitDetails.cpp.

QString node_path ( ) const

Gives the node path.

Returns
Returns the node path. This string may be empty if it has never been set.

Definition at line 182 of file CommitDetails.cpp.

QModelIndex parent ( const QModelIndex &  index) const

Implements QAbstractItemModel::parent()

Gives the parent index of a provided index. index Index from which we want to know the parent index.

Note
Since this is not a tree-based model, this implementation always returns a invalid index.
Returns
Returns the parent index.

Definition at line 134 of file CommitDetails.cpp.

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

Implements QAbstractItemModel::rowCount()

Gives the number of children under a parent

Parameters
parentThe parent. May be null.
Returns
Returns the number of children under parent.

Definition at line 141 of file CommitDetails.cpp.

void set_node_path ( const QString &  node_path)

Sets the node path.

Parameters
nodePathNode path.

Definition at line 189 of file CommitDetails.cpp.

void set_option ( const QString &  optionName,
const QString &  oldValue,
const QString &  currentValue 
)

Sets a option.

If the option already exists, ites are modified. Otherwise, the option is created.

Parameters
optionNameOption name
oldValueOld Value. May be empty.
currentValueCurrent value. May be empty.

Definition at line 158 of file CommitDetails.cpp.

Member Data Documentation

QList<CommitDetailsItem *> m_items
private

Model items.

Definition at line 145 of file CommitDetails.hpp.

QString m_node_path
private

Node path.

Definition at line 142 of file CommitDetails.hpp.


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