Optika::TreeModel Class Reference

#include <Optika_treemodel.hpp>

Collaboration diagram for Optika::TreeModel:
Collaboration graph
[legend]

List of all members.

Signals

void hideData (int row, const QModelIndex &parent)
void showData (int row, const QModelIndex &parent)
void badValue (QModelIndex badItem, QString message)

Public Member Functions

 TreeModel (Teuchos::RCP< Teuchos::ParameterList > validParameters, QString saveFileName=QString(), QObject *parent=0)
 TreeModel (Teuchos::RCP< Teuchos::ParameterList > validParameters, Teuchos::RCP< Optika::DependencySheet > dependencySheet, QString saveFileName=QString(), QObject *parent=0)
 ~TreeModel ()
QVariant data (const QModelIndex &index, int role) const
Qt::ItemFlags flags (const QModelIndex &index) const
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
QModelIndex parent (const QModelIndex &index) const
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
int rowCount (const QModelIndex &parent=QModelIndex()) const
int columnCount (const QModelIndex &parent=QModelIndex()) const
void issueInitilizationSignals ()
void printOut () const
bool writeOutput (QString fileName)
void readInput (QString fileName)
QString getSaveFileName ()
bool isSaved ()
void reset ()
QString itemType (const QModelIndex &index) const
bool hasDependencies ()
bool hasValidValue (QModelIndex valueToCheck) const
Teuchos::RCP< const
Teuchos::ParameterEntryValidator > 
getValidator (const QModelIndex &index) const
template<class S >
Teuchos::Array< S > getArray (const QModelIndex &index)
Teuchos::RCP< const
Teuchos::ParameterList > 
getCurrentParameters ()

Detailed Description

TreeModel is a type of QAbstractItemModel that has a Tree like structure.

Note: For all undocumented functions, please refer to the Qt api. They will have a good desciption.


Constructor & Destructor Documentation

Optika::TreeModel::TreeModel ( Teuchos::RCP< Teuchos::ParameterList >  validParameters,
QString  saveFileName = QString(),
QObject *  parent = 0 
)

Constructs the TreeModel.

Parameters:
validParameters A list of parameters for which the users must enter values. Note the Parameter List will be edited. All user input will be stored in it.
saveFileName Name of a save file used in a previous attempt to get values for the validParameters ParameterList.
parent The parent object.
Optika::TreeModel::TreeModel ( Teuchos::RCP< Teuchos::ParameterList >  validParameters,
Teuchos::RCP< Optika::DependencySheet dependencySheet,
QString  saveFileName = QString(),
QObject *  parent = 0 
)

Constructs the TreeModel.

Parameters:
validParameters A list of parameters for which the users must enter values.
dependencySheet A sheet listing any dependencies between parameters in the validParameters ParameterList.
saveFileName Name of a save file used in a previous attempt to get values for the validParameters ParameterList.
parent The parent object.
Optika::TreeModel::~TreeModel (  ) 

Deconstructor for the TreeModel.


Member Function Documentation

void Optika::TreeModel::badValue ( QModelIndex  badItem,
QString  message 
) [signal]

Emitted when it has been determined that a TreeItem no longer has a valid value.

Parameters:
badItem The index of the item that now has a bad value.
message A message describing what happened to cause the item to obtain an invalid value.
template<class S >
Teuchos::Array<S> Optika::TreeModel::getArray ( const QModelIndex &  index  )  [inline]

Gets the array for a particular TreeItem.

Parameters:
index The index of the TreeItem whose arrays is sought.
Returns:
The array at the given index.
Teuchos::RCP< const Teuchos::ParameterList > Optika::TreeModel::getCurrentParameters (  ) 

Get a ParameterList containing all of the parameters at their current settings.

Returns:
A ParameterList containing all of the parameters at their current settings.
QString Optika::TreeModel::getSaveFileName (  ) 

Gets the name of the save file with which the TreeModel is associated. If the TreeModel has yet to be saved and thus has no save file associated with it, the funtion will return an empty string.

Returns:
The name of the save file with which the TreeModel is associated.
Teuchos::RCP< const Teuchos::ParameterEntryValidator > Optika::TreeModel::getValidator ( const QModelIndex &  index  )  const

Gets the validator for a particular TreeItem.

Parameters:
index The index of the TreeItem whose validators is sought.
Returns:
The validator at the given index.
bool Optika::TreeModel::hasDependencies (  ) 

Determines whether or not a Dependent Parameter List is being used in the TreeModel.

Returns:
True if the TreeModel has dependencies, false otherwise.
bool Optika::TreeModel::hasValidValue ( QModelIndex  valueToCheck  )  const

Determines whether or not the value at the valueToCheck is valid.

Parameters:
valueToCheck The index of the item whose valididty is in questions.
Returns:
True if the value at index is valid, false otherwise.
void Optika::TreeModel::hideData ( int  row,
const QModelIndex &  parent 
) [signal]

Emitted when a row should be hidden.

Parameters:
row The row of the item that should be hidden.
parent The parent of the item that should be hidden.
bool Optika::TreeModel::isSaved (  ) 

Determines wether or not the current state of TreeModel has been saved.

Returns:
True if the current state of the TreeModel has been saved. False otherwise.
void Optika::TreeModel::issueInitilizationSignals (  ) 

If this TreeModel has a dependent Parameter List, then all the depndencies need to be evaluated before the Parameter List may be displayed. Certain items might need to be hidden before the user even starts entering data. This function goes through all of the depndees in the Dependent Parameter List and issues a signal saying they've changed. They really haven't changed yet, but this allows all the depndencies to be evaluated and any initial visual settings to be displayed correctly.

QString Optika::TreeModel::itemType ( const QModelIndex &  index  )  const

Returns the type of item located at the specified QModelIndex.

Parameters:
index The index of the TreeItem.
Returns:
The type of the item at the index.
void Optika::TreeModel::printOut (  )  const

Prints out the model.

void Optika::TreeModel::readInput ( QString  fileName  ) 

Reads an xml file that describes the state of current parameters in xml format.

Parameters:
fileName The name of the file from which the TreeModel should read parameter values.
void Optika::TreeModel::reset (  ) 

Resets all the inputs to their default values.

void Optika::TreeModel::showData ( int  row,
const QModelIndex &  parent 
) [signal]

Emitted when a row should be shown.

Parameters:
row The row of the item that should be shown.
parent The parent of the item that should be shown.
bool Optika::TreeModel::writeOutput ( QString  fileName  ) 

Writes out the state of the current parameters in xml format.

Parameters:
fileName The name of the file to which the TreeModel should write the XML output.

The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Enumerations
Generated on Wed Apr 13 10:05:55 2011 for Optika by  doxygen 1.6.3