|
Optika
Development
|
TreeModel is a type of QAbstractItemModel that has a Tree like structure. More...
#include <Optika_treemodel.hpp>


Signals | |
Public Signals | |
| void | hideData (int row, const QModelIndex &parent) |
| Emitted when a row should be hidden. More... | |
| void | showData (int row, const QModelIndex &parent) |
| Emitted when a row should be shown. More... | |
| void | badValue (QModelIndex badItem, QString message) |
| Emitted when it has been determined that a TreeItem no longer has a valid value. More... | |
Public Member Functions | |
Constructors/Destructor | |
| TreeModel (RCP< ParameterList > validParameters, RCP< DependencySheet > dependencySheet=null, QString saveFileName=QString(), QObject *parent=0) | |
| Constructs the TreeModel. More... | |
| ~TreeModel () | |
| Deconstructor for the TreeModel. | |
Overridden from QAbstractItemModel | |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) 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 |
Helper Functions | |
| void | issueInitilizationSignals () |
| Issues any signals that need to be emitted right away. More... | |
Debug Functions | |
| void | printOut () const |
| Prints out the model. | |
Input/Output Functions | |
| bool | writeOutput (QString fileName) |
| Writes out the state of the current parameters in xml format. More... | |
| void | readInput (QString fileName) |
| Reads an xml file that describes the state of current parameters in xml format. More... | |
Getters and Setters | |
| QString | getSaveFileName () |
| Gets the name of the save file with which the TreeModel is associated. More... | |
| bool | isSaved () |
| Determines wether or not the current state of TreeModel has been saved. More... | |
| void | reset () |
| Resets all the inputs to their default values. | |
| QString | itemType (const QModelIndex &index) const |
| Returns the type of item located at the specified QModelIndex. More... | |
| bool | hasDependencies () |
| Determines whether or not a Dependent Parameter List is being used in the TreeModel. More... | |
| bool | hasValidValue (QModelIndex valueToCheck) const |
| Determines whether or not the value at the valueToCheck is valid. More... | |
| RCP< const ParameterEntryValidator > | getValidator (const QModelIndex &index) const |
| Gets the validator for a particular TreeItem. More... | |
| template<class S > | |
| Array< S > | getArray (const QModelIndex &index) |
| Gets the array for a particular TreeItem. More... | |
| template<class S > | |
| TwoDArray< S > | getTwoDArray (const QModelIndex &index) |
| Gets the TwoDArray for a particular TreeItem. More... | |
| RCP< const ParameterList > | getCurrentParameters () |
| Get a ParameterList containing all of the parameters at their current settings. More... | |
| QModelIndex | findParameterEntryIndex (RCP< const ParameterEntry > parameterEntry) |
| Finds the index of a particular parameter entry. More... | |
Static Public Member Functions | |
Constant Getting Functions. | |
| static const int | getRawDataRole () |
| Returns constant representing the RawDataRole. More... | |
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.
| Optika::TreeModel::TreeModel | ( | RCP< ParameterList > | validParameters, |
| RCP< DependencySheet > | dependencySheet = null, |
||
| QString | saveFileName = QString(), |
||
| QObject * | parent = 0 |
||
| ) |
Constructs the TreeModel.
| 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. |
|
signal |
Emitted when it has been determined that a TreeItem no longer has a valid value.
| 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. |
Referenced by findParameterEntryIndex(), getRawDataRole(), and setData().
| int Optika::TreeModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
References Optika::TreeItem::columnCount().
| QVariant Optika::TreeModel::data | ( | const QModelIndex & | index, |
| int | role = Qt::DisplayRole |
||
| ) | const |
References Optika::TreeItem::data(), and getRawDataRole().
Referenced by findParameterEntryIndex(), Optika::Delegate::updateEditorGeometry(), and writeOutput().
| QModelIndex Optika::TreeModel::findParameterEntryIndex | ( | RCP< const ParameterEntry > | parameterEntry | ) |
Finds the index of a particular parameter entry.
| parameterEntry | The ParameterEntry whose index is being sought. |
References Optika::TreeItem::appendChild(), badValue(), data(), Optika::TreeItem::getEntry(), Optika::TreeItem::hasEntry(), hasValidValue(), hideData(), index(), parent(), readInput(), and showData().
Referenced by getTwoDArray(), and issueInitilizationSignals().
| Qt::ItemFlags Optika::TreeModel::flags | ( | const QModelIndex & | index | ) | const |
|
inline |
| RCP< const ParameterList > Optika::TreeModel::getCurrentParameters | ( | ) |
Get a ParameterList containing all of the parameters at their current settings.
References index(), parent(), and rowCount().
Referenced by getTwoDArray().
|
inlinestatic |
Returns constant representing the RawDataRole.
References badValue(), hideData(), and showData().
Referenced by data(), Optika::TreeItem::data(), and Optika::Delegate::updateEditorGeometry().
| QString Optika::TreeModel::getSaveFileName | ( | ) |
|
inline |
Gets the TwoDArray for a particular TreeItem.
| index | The index of the TreeItem whose TwoDArray is sought. |
References findParameterEntryIndex(), and getCurrentParameters().
| RCP< const ParameterEntryValidator > Optika::TreeModel::getValidator | ( | const QModelIndex & | index | ) | const |
Gets the validator for a particular TreeItem.
| index | The index of the TreeItem whose validators is sought. |
Referenced by Optika::Delegate::updateEditorGeometry().
| bool Optika::TreeModel::hasDependencies | ( | ) |
Determines whether or not a Dependent Parameter List is being used in the TreeModel.
Referenced by Optika::TreeView::TreeView().
| bool Optika::TreeModel::hasValidValue | ( | QModelIndex | valueToCheck | ) | const |
Determines whether or not the value at the valueToCheck is valid.
| valueToCheck | The index of the item whose valididty is in questions. |
References Optika::TreeItem::hasValidValue().
Referenced by findParameterEntryIndex().
| QVariant Optika::TreeModel::headerData | ( | int | section, |
| Qt::Orientation | orientation, | ||
| int | role = Qt::DisplayRole |
||
| ) | const |
References Optika::TreeItem::data().
|
signal |
Emitted when a row should be hidden.
| row | The row of the item that should be hidden. |
| parent | The parent of the item that should be hidden. |
Referenced by findParameterEntryIndex(), and getRawDataRole().
| QModelIndex Optika::TreeModel::index | ( | int | row, |
| int | column, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) | const |
References Optika::TreeItem::child().
Referenced by findParameterEntryIndex(), getCurrentParameters(), Optika::SearchWidget::SearchWidget(), and writeOutput().
| bool Optika::TreeModel::isSaved | ( | ) |
| void Optika::TreeModel::issueInitilizationSignals | ( | ) |
Issues any signals that need to be emitted right away.
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.
References findParameterEntryIndex().
Referenced by reset(), and Optika::TreeView::TreeView().
| QString Optika::TreeModel::itemType | ( | const QModelIndex & | index | ) | const |
Returns the type of item located at the specified QModelIndex.
| index | The index of the TreeItem. |
| QModelIndex Optika::TreeModel::parent | ( | const QModelIndex & | index | ) | const |
References Optika::TreeItem::parent(), and Optika::TreeItem::row().
Referenced by findParameterEntryIndex(), and getCurrentParameters().
| void Optika::TreeModel::readInput | ( | QString | fileName | ) |
Reads an xml file that describes the state of current parameters in xml format.
| fileName | The name of the file from which the TreeModel should read parameter values. |
Referenced by findParameterEntryIndex(), and reset().
| int Optika::TreeModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
| bool Optika::TreeModel::setData | ( | const QModelIndex & | index, |
| const QVariant & | value, | ||
| int | role = Qt::EditRole |
||
| ) |
References badValue(), Optika::TreeItem::changeValue(), Optika::TreeItem::getCurrentInvalidValueMessage(), and Optika::TreeItem::hasValidValue().
Referenced by Optika::Delegate::setModelData(), and writeOutput().
|
signal |
Emitted when a row should be shown.
| row | The row of the item that should be shown. |
| parent | The parent of the item that should be shown. |
Referenced by findParameterEntryIndex(), and getRawDataRole().
| bool Optika::TreeModel::writeOutput | ( | QString | fileName | ) |
1.8.11