tuchulcha  0.10.1
Graphical Workflow Configuration Editor
GraphModel Class Reference

This model wraps a ParameterFile instance and provides access to the data interpreted as a (directed) graph. More...

#include <GraphModel.h>

Inheritance diagram for GraphModel:

Public Slots

QString addNode (QString className, bool draw=true)
 add new node of given kind More...
 
void connectSlot (QString source, QString target, bool draw=true)
 connect slots More...
 
bool deleteNode (QString nodename, bool draw=true)
 delete node More...
 
void disconnectAllSlots (QString node, bool draw=true)
 disconnect all slots of given node More...
 
void disconnectSlot (QString source, QString target=QString(), bool draw=true)
 disconnect slots More...
 
virtual void loadMetaFile (QString fileName)
 load metaFile More...
 
void reDraw ()
 emit graph changed signal to update displays More...
 
void renameNode (QString nodename, bool draw=true)
 rename node More...
 
void selectNext (bool back=false)
 select next item More...
 
- Public Slots inherited from ParameterFileModel
virtual bool load (const QString &fName="")
 Load model content from parameterFile. More...
 
virtual void loadMetaInfo (const QString &fileName)
 load metaFile More...
 
virtual void save (const QString &fileName="")
 Save model content to a text file. More...
 
virtual void setFileName (const QString &fileName)
 Set new value for Property _fileName. More...
 
void setHandleDynamics (bool)
 set _handleDynamics
 
void setMinPriority (int value)
 Set property _minPriority. More...
 
void setOnlyParams (bool value)
 Set property _onlyparams. More...
 
virtual QString setPrefix (const QString &prefix)
 Change prefix. More...
 
void setUseMetaInfo (bool value)
 Set property _useMetadata. More...
 

Signals

void graphChanged ()
 Initiate graph rebuild and Display refresh.
 
- Signals inherited from ParameterFileModel
void commentChanged (QString comment)
 inform about editor comment change
 
void dynamicUpdate ()
 inform about dynamic plugin update
 
void fileNameChanged (QString fileName)
 Property _fileName has changed. More...
 
void metaInfoChanged (bool valid)
 New metadata have been loaded. More...
 
void minPriorityChanged (int value)
 Property _minPriority changed. More...
 
void modified (bool val)
 inform about modifications More...
 
void onlyParamsChanged (bool value)
 Property _onlyParams changed. More...
 
void prefixChanged (const QString &prefix)
 Property _prefix has changed. More...
 
void statusMessage (const QString &msg)
 send status message More...
 
void useMetaInfoChanged (bool value)
 Property _useMetadata changed. More...
 

Public Member Functions

 GraphModel (QString fileName="", QObject *parent=0, QString metaFile="")
 Constructor initializing the model with the given file. More...
 
virtual void clear (bool draw)
 Clear ParameterFile content. More...
 
virtual void clear ()
 Clear ParameterFile content with redraw. More...
 
bool connected (QString source, QString target) const
 Check if given connection is valid and established. More...
 
QStringList nodes () const
 Get nodes in current graph.
 
bool nodeValid (const QString &name) const
 Checks if the given node is a valid object in the ParameterFile. More...
 
virtual bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex())
 Remove data from the model. More...
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 Set item content. More...
 
- Public Member Functions inherited from ParameterFileModel
 ParameterFileModel (QString fileName="", QObject *parent=0, QString metaFile="")
 Constructor initializing the model with the given file. More...
 
virtual ~ParameterFileModel ()
 Default destructor.
 
bool active () const
 Returns the bool value of the Active Parameter.
 
void deactivate ()
 Deactivate all following plugins.
 
QString fileName () const
 Get property _fileName.
 
int minPriority () const
 Get property _minPriority.
 
bool onlyParams () const
 Get property _onlyparams.
 
const QParameterFileparameterFile () const
 Get const pointer of ParameterFile.
 
QString prefix () const
 Get property _prefix.
 
bool prefixValid () const
 Check prefix.
 
void reactivate ()
 Reactivate all following plugins.
 
void reactivatePreviousPlugins ()
 Reactivates all previous plugins.
 
bool useMetaInfo () const
 Get property _useMetadata;.
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 Return number of table rows. More...
 
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 Return number of table columns. More...
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Access to item content. More...
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 Item flags (editable etc). More...
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Data for the table headers. More...
 
virtual bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex())
 Add data to the model. More...
 
virtual Qt::DropActions supportedDropActions () const
 
virtual QStringList mimeTypes () const
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 
bool metaInfoValid () const
 check for available metaInfos
 
QStringList getClasses () const
 get classes contained in metadata file
 
QString getClass (QString objName, bool fixCase=false) const
 get class of some given object More...
 
QString getType (QString parName, bool applyTmplType=true) const
 Get type of some parameter or slot. More...
 
QString getDefault (QString parName) const
 pass to metaInfo, use dynamic metadata if needed
 
QString getDoc (QString parName) const
 pass to metaInfo, use dynamic metadata if needed
 
QStringList getInputs (QString objName) const
 Get input slots of object. More...
 
QStringList getInputDisplayNames (QString objName) const
 Get input slots of object. More...
 
QStringList getOutputs (QString objName) const
 Get output slots of object. More...
 
QStringList getOutputDisplayNames (QString objName) const
 Get output slots of object. More...
 
QStringList getParameters (QString objName) const
 Get parameters of object. More...
 
bool isParameter (QString name) const
 Check if some parameter/slot is a parameter. More...
 
bool isInputSlot (QString name) const
 Check if some parameter/slot is an input slot. More...
 
bool isOutputSlot (QString name) const
 Check if some parameter/slot is an output slot. More...
 
bool isMultiSlot (QString name) const
 Check if some slot is a multi slot. More...
 
QString getValue (QString parName) const
 Get a parameter from the underlying parameter file. More...
 
void setValue (QString parName, QString value)
 Set a parameter in the underlying parameter file. More...
 
bool isSet (QString parName) const
 pass to QParameterFile::isSet
 
void erase (QString parName)
 Delete a parameter from the the underlying parameter file. More...
 
bool rename (QString oldPrefix, QString newPrefix)
 rename prefix More...
 

Protected Slots

virtual bool _load ()
 Load data without showing OpenFile Dialog.
 
- Protected Slots inherited from ParameterFileModel
virtual bool _load ()
 Load data without showing OpenFile Dialog. More...
 
virtual void _update ()
 Update content (e.g. when prefix has changed)
 
virtual void _updatePriority (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 Update filter if priority changed.
 

Additional Inherited Members

- Protected Attributes inherited from ParameterFileModel
QMutex * _resetMutex
 avoid multiple reset model calls
 
- Properties inherited from ParameterFileModel
QString _fileName
 Store filename of the model data file.
 
int _minPriority
 minimum priority to be listed
 
bool _onlyParams
 only show configurable parameters
 
QString _prefix
 Parameter prefix.
 
bool _useMetaInfo
 toggle usage of metadata
 

Detailed Description

Definition at line 32 of file GraphModel.h.

Constructor & Destructor Documentation

GraphModel::GraphModel ( QString  fileName = "",
QObject *  parent = 0,
QString  metaFile = "" 
)
Parameters
metaFileParameterFile describing classes and in-/outputs
fileNamefilename of the textfile to load.
parentparent QObject passed to inherited constructor.

Definition at line 49 of file GraphModel.cpp.

References ParameterFileModel::dynamicUpdate(), graphChanged(), and ParameterFileModel::useMetaInfo().

Member Function Documentation

QString GraphModel::addNode ( QString  className,
bool  draw = true 
)
slot
Parameters
classNamename of the class to create a new node
drawemit display refresh signal if true
Returns
QString name of new node (entered by user)

Definition at line 385 of file GraphModel.cpp.

References QTextInputDialog::getText(), graphChanged(), nodeValid(), QParameterFile::prefixCheck, ParameterFileModel::setValue(), and ParameterFileModel::statusMessage().

void GraphModel::clear ( bool  draw)
virtual
Parameters
drawemit display refresh signal if true

Definition at line 66 of file GraphModel.cpp.

References ParameterFileModel::clear(), graphChanged(), and ParameterFileModel::setPrefix().

void GraphModel::clear ( )
virtual

This has to be set up separately to override the parent class method.

Reimplemented from ParameterFileModel.

Definition at line 73 of file GraphModel.cpp.

bool GraphModel::connected ( QString  source,
QString  target 
) const

This can also be used, to check if a connection could be established (using an exception as hint, that something goes wrong).

Parameters
sourcesource slot ("\<object\>.\<slot\>")
targettarget slot ("\<object\>.\<slot\>")
Exceptions
runtime_errorif connection is not valid
Return values
truenodes are connected

Definition at line 128 of file GraphModel.cpp.

References ParameterFileModel::getType(), ParameterFileModel::getValue(), ParameterFileModel::isInputSlot(), and ParameterFileModel::isOutputSlot().

void GraphModel::connectSlot ( QString  source,
QString  target,
bool  draw = true 
)
slot
Parameters
sourcesource slot ("\<object\>.\<slot\>")
targettarget slot ("\<object\>.\<slot\>")
drawemit display refresh signal if true

Definition at line 175 of file GraphModel.cpp.

References connected(), disconnectSlot(), ParameterFileModel::getValue(), graphChanged(), ParameterFileModel::isInputSlot(), ParameterFileModel::isMultiSlot(), ParameterFileModel::setValue(), and ParameterFileModel::statusMessage().

bool GraphModel::deleteNode ( QString  nodename,
bool  draw = true 
)
slot
void GraphModel::disconnectAllSlots ( QString  node,
bool  draw = true 
)
slot
Parameters
nodenode name ("\<object\>")
drawemit display refresh signal if true

Definition at line 249 of file GraphModel.cpp.

References disconnectSlot(), ParameterFileModel::getInputs(), ParameterFileModel::getOutputs(), graphChanged(), and ParameterFileModel::statusMessage().

void GraphModel::disconnectSlot ( QString  source,
QString  target = QString(),
bool  draw = true 
)
slot
Parameters
sourcesource slot ("\<object\>.\<slot\>")
targettarget slot ("\<object\>.\<slot\>"), disconnect from all targets, if empty
drawemit display refresh signal if true

Definition at line 222 of file GraphModel.cpp.

References ParameterFileModel::getValue(), graphChanged(), ParameterFileModel::setValue(), and ParameterFileModel::statusMessage().

void GraphModel::loadMetaFile ( QString  fileName)
virtualslot
Parameters
fileNamefilename to load from

Definition at line 169 of file GraphModel.cpp.

References ParameterFileModel::loadMetaInfo().

bool GraphModel::nodeValid ( const QString &  name) const
Parameters
namenode name
Return values
truenode is valid

Definition at line 124 of file GraphModel.cpp.

References ParameterFileModel::getClass().

void GraphModel::reDraw ( )
slot

this has to be done, when the ParameterFileModel content has been changed so that the graph structure has to be redrawn

Definition at line 77 of file GraphModel.cpp.

References graphChanged().

bool GraphModel::removeRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
virtual
Parameters
rowfirst row to delete
countnumber of rows to append
parentparent item (here unused)
Returns
sucess of the operation
Remarks
Only removing the tail is allowed!

Reimplemented from ParameterFileModel.

Definition at line 476 of file GraphModel.cpp.

References ParameterFileModel::data(), ParameterFileModel::getDefault(), ParameterFileModel::prefix(), ParameterFileModel::removeRows(), and setData().

void GraphModel::renameNode ( QString  nodename,
bool  draw = true 
)
slot
Parameters
nodenamename of the node to rename
drawemit display refresh signal if true

Definition at line 264 of file GraphModel.cpp.

References QTextInputDialog::getText(), graphChanged(), nodeValid(), QParameterFile::prefixCheck, ParameterFileModel::rename(), and ParameterFileModel::statusMessage().

void GraphModel::selectNext ( bool  back = false)
slot
Parameters
backselect previous item, if back is true

Definition at line 362 of file GraphModel.cpp.

References nodes(), ParameterFileModel::prefix(), ParameterFileModel::prefixValid(), and ParameterFileModel::setPrefix().

bool GraphModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
virtual

Overwrite the current value with the given one.

Parameters
indexitem index
valuenew value to set
roledisplay role
Return values
truedata successfully set
falsefailure setting value

Reimplemented from ParameterFileModel.

Definition at line 444 of file GraphModel.cpp.

References ParameterFileModel::data(), disconnectSlot(), ParameterFileModel::getInputs(), ParameterFileModel::getOutputs(), ParameterFileModel::getType(), graphChanged(), ParameterFileModel::prefix(), ParameterFileModel::prefixValid(), and ParameterFileModel::setData().


The documentation for this class was generated from the following files: