41 #ifndef OPTIKA_MODEL_HPP_
42 #define OPTIKA_MODEL_HPP_
43 #include <QAbstractItemModel>
44 #include <QModelIndex>
98 QVariant
data(
const QModelIndex &
index,
int role = Qt::DisplayRole)
const;
100 Qt::ItemFlags
flags(
const QModelIndex &index)
const;
102 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const;
104 QModelIndex
index(
int row,
int column,
const QModelIndex &
parent = QModelIndex())
const;
106 QModelIndex
parent(
const QModelIndex &index)
const;
108 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole);
110 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
112 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
195 QString
itemType(
const QModelIndex &index)
const;
269 static const int RawDataRole = Qt::UserRole;
286 void hideData(
int row,
const QModelIndex& parent);
294 void showData(
int row,
const QModelIndex& parent);
303 void badValue(QModelIndex badItem, QString message);
360 itemEntry(
const QModelIndex &index)
const;
435 const QDomElement& element,
436 const QModelIndex& potentialMatch)
const;
void badValue(QModelIndex badItem, QString message)
Emitted when it has been determined that a TreeItem no longer has a valid value.
RCP< DependencySheet > dependencySheet
The dependency sheet being used to determine any depdendencies between parameters.
void showData(int row, const QModelIndex &parent)
Emitted when a row should be shown.
bool saved
Whether or not the model has been saved since it was last modified.
Qt::ItemFlags flags(const QModelIndex &index) const
QModelIndex findParameterEntryIndex(RCP< const ParameterEntry > parameterEntry)
Finds the index of a particular parameter entry.
void reset()
Resets all the inputs to their default values.
void currentFileNowModified()
When the state of any of the MainTree's items is changed, this slot should be called.
RCP< const ParameterList > canonicalList
A canonical list of what the validParameters were when they were first passed to the treemodel...
void insertParameterList(RCP< ParameterList > parameterList, RCP< ParameterEntry > listEntry, std::string plname, TreeItem *parent)
Inserts a new parameter list into the model.
TreeItem * rootItem
The root item of the model.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
TreeModel(RCP< ParameterList > validParameters, RCP< DependencySheet > dependencySheet=null, QString saveFileName=QString(), QObject *parent=0)
Constructs the TreeModel.
QString itemType(const QModelIndex &index) const
Returns the type of item located at the specified QModelIndex.
bool hasValidValue(QModelIndex valueToCheck) const
Determines whether or not the value at the valueToCheck is valid.
QString getSaveFileName()
Gets the name of the save file with which the TreeModel is associated.
bool dependencies
Whether or not the model has any dependencies.
bool isRootIndex(const QModelIndex &index) const
void setIsSaved()
Set save state to true.
RCP< const ParameterList > getCurrentParameters()
Get a ParameterList containing all of the parameters at their current settings.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
QString saveFileName
The name of the savefile associated with the model.
QModelIndex parent(const QModelIndex &index) const
RCP< const ParameterEntry > itemEntry(const QModelIndex &index) const
Gets the ParameterEntry object given a QModelIndex.
TwoDArray< S > getTwoDArray(const QModelIndex &index)
Gets the TwoDArray for a particular TreeItem.
void processInputElement(const QDomElement &element)
Given a Dom element, searches for the corresponding parameter in the model, updates it's value with t...
bool isRealMatch(const QDomElement &element, const QModelIndex &potentialMatch) const
Determines whether or not a model index corresponds to the parameter represented by the DomElement...
bool writeOutput(QString fileName)
Writes out the state of the current parameters in xml format.
void printOut() const
Prints out the model.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
void readInput(QString fileName)
Reads an xml file that describes the state of current parameters in xml format.
The TreeItem class is the item class used by the TreeModel class.
RCP< const ParameterEntryValidator > getValidator(const QModelIndex &index) const
Gets the validator for a particular TreeItem.
~TreeModel()
Deconstructor for the TreeModel.
int rowCount(const QModelIndex &parent=QModelIndex()) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
void hideData(int row, const QModelIndex &parent)
Emitted when a row should be hidden.
RCP< ParameterList > validParameters
The list of valid parameters.
void dataChangedListener(const QModelIndex &index1, const QModelIndex &index2)
Listens to see if any data has changed.
bool isSaved()
Determines wether or not the current state of TreeModel has been saved.
QModelIndex parameterEntryMatch(const QModelIndex &start, const RCP< const ParameterEntry > ¶meterEntry) const
Finds the QModelIndex associated with a parameter entry.
void issueInitilizationSignals()
Issues any signals that need to be emitted right away.
void checkDependentState(const QModelIndex dependee, RCP< Dependency > dependency)
Checks the state of a dependent after it's dependency has been evaluated.
void basicSetup(QString saveFileName)
Basic setup shared by each of the constructors.
Array< S > getArray(const QModelIndex &index)
Gets the array for a particular TreeItem.
bool hasDependencies()
Determines whether or not a Dependent Parameter List is being used in the TreeModel.
void readInParameterList(RCP< ParameterList > validParameters, TreeItem *parentItem)
Reads in the parameter list to be represented by the model.
TreeModel is a type of QAbstractItemModel that has a Tree like structure.
void insertParameter(RCP< ParameterEntry > parameter, std::string name, TreeItem *parent)
Inserts a new parameter into the model.
int columnCount(const QModelIndex &parent=QModelIndex()) const
static const int getRawDataRole()
Returns constant representing the RawDataRole.