tuchulcha  0.10.1
Graphical Workflow Configuration Editor
GraphModel.h
Go to the documentation of this file.
1 /* Copyright (C) 2009 Jens-Malte Gottfried
2 
3  This file is part of Tuchulcha.
4 
5  Tuchulcha is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Tuchulcha is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Tuchulcha. If not, see <http://www.gnu.org/licenses/>.
17 */
25 #ifndef GRAPHMODEL_H_
26 #define GRAPHMODEL_H_
27 
28 #include "ParameterFileModel.h"
29 
33  Q_OBJECT
34 
35 public:
37 
41  GraphModel(QString fileName = "", QObject* parent = 0,
42  QString metaFile = "");
43 
45 
46  virtual void clear(bool draw);
47 
49 
52  virtual void clear();
53 
55 
58  bool nodeValid(const QString& name) const;
59 
61 
68  bool connected(QString source, QString target) const;
69 
70 
72  QStringList nodes() const;
73 
74  virtual bool setData (
75  const QModelIndex& index, const QVariant& value,
76  int role = Qt::EditRole);
77  virtual bool removeRows (
78  int row, int count,
79  const QModelIndex& parent = QModelIndex());
80 
81 public slots:
83 
85  void selectNext(bool back = false);
86 
88 
92  QString addNode(QString className, bool draw = true);
93 
95 
98  void renameNode(QString nodename, bool draw = true);
99 
101 
104  bool deleteNode(QString nodename, bool draw = true);
105 
107 
111  void connectSlot(QString source, QString target, bool draw = true);
112 
114 
119  void disconnectSlot(QString source, QString target = QString(), bool draw = true);
120 
122 
125  void disconnectAllSlots(QString node, bool draw = true);
126  // \}
127 
129 
130  virtual void loadMetaFile(QString fileName);
131 
133 
136  void reDraw();
137 
138 protected slots:
140  virtual bool _load();
141 
142 signals:
144  void graphChanged();
145 };
146 
147 #endif /* GRAPHMODEL_H_ */
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Set item content.
Definition: GraphModel.cpp:444
This model wraps a ParameterFile instance and provides access to the data interpreted as a (directed)...
Definition: GraphModel.h:32
QStringList nodes() const
Get nodes in current graph.
Definition: GraphModel.cpp:343
Declaration of class ParameterFileModel.
void disconnectAllSlots(QString node, bool draw=true)
disconnect all slots of given node
Definition: GraphModel.cpp:249
GraphModel(QString fileName="", QObject *parent=0, QString metaFile="")
Constructor initializing the model with the given file.
Definition: GraphModel.cpp:49
void graphChanged()
Initiate graph rebuild and Display refresh.
void reDraw()
emit graph changed signal to update displays
Definition: GraphModel.cpp:77
void selectNext(bool back=false)
select next item
Definition: GraphModel.cpp:362
This model serves to provide a model frontend to access a ParameterFile instance. ...
QString addNode(QString className, bool draw=true)
add new node of given kind
Definition: GraphModel.cpp:385
void disconnectSlot(QString source, QString target=QString(), bool draw=true)
disconnect slots
Definition: GraphModel.cpp:222
bool connected(QString source, QString target) const
Check if given connection is valid and established.
Definition: GraphModel.cpp:128
bool deleteNode(QString nodename, bool draw=true)
delete node
Definition: GraphModel.cpp:301
QString fileName() const
Get property _fileName.
void connectSlot(QString source, QString target, bool draw=true)
connect slots
Definition: GraphModel.cpp:175
void renameNode(QString nodename, bool draw=true)
rename node
Definition: GraphModel.cpp:264
bool nodeValid(const QString &name) const
Checks if the given node is a valid object in the ParameterFile.
Definition: GraphModel.cpp:124
virtual void clear()
Clear ParameterFile content with redraw.
Definition: GraphModel.cpp:73
virtual bool _load()
Load data without showing OpenFile Dialog.
Definition: GraphModel.cpp:81
virtual void loadMetaFile(QString fileName)
load metaFile
Definition: GraphModel.cpp:169
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Remove data from the model.
Definition: GraphModel.cpp:476