tuchulcha  0.10.1
Graphical Workflow Configuration Editor
ModelToolBar.cpp
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 #include <QAction>
26 
27 #include "ModelToolBar.h"
28 #include "GraphModel.h"
29 
30 ModelToolBar::ModelToolBar(const QString& title, QWidget* myParent) :
31  QToolBar(title, myParent),
32  _model(0) {
33 }
34 
36 }
37 
39  QAction* act;
40  act = addAction(
41  QIcon::fromTheme("edit-delete",QIcon(":/icons/edit-delete.png")),
42  tr("delete\nnode"), this, SLOT(_delete()));
43  act->setToolTip(tr("delete selected node"));
44 
45  act = addAction(
46  QIcon::fromTheme("edit-rename",QIcon(":/icons/edit-rename.png")),
47  tr("rename\nnode"), this, SLOT(_rename()));
48  act->setToolTip(tr("rename selected node"));
49 
50  act = addAction(
51  QIcon::fromTheme("network-disconnect",QIcon(":/icons/network-disconnect.png")),
52  tr("disconnect\nnode"), this, SLOT(_disconnect()));
53  act->setToolTip(tr("disconnect all slots of selected node"));
54 }
55 
57  _model = qobject_cast<GraphModel*>(model);
58 }
59 
61  if (_model && !_model->prefix().isEmpty() && _model->prefixValid())
63 }
64 
66  if (_model && !_model->prefix().isEmpty() && _model->prefixValid())
68 }
69 
71  if (_model && !_model->prefix().isEmpty() && _model->prefixValid())
73 }
74 
75 void ModelToolBar::addNode(QString type) {
76  if (_model) {
77  _model->addNode(type);
78  }
79 }
This model wraps a ParameterFile instance and provides access to the data interpreted as a (directed)...
Definition: GraphModel.h:32
virtual ~ModelToolBar()
default destructor
void disconnectAllSlots(QString node, bool draw=true)
disconnect all slots of given node
Definition: GraphModel.cpp:249
Declaration of class ModelToolBar.
Declaration of class GraphModel.
QString prefix() const
Get property _prefix.
void setModel(ParameterFileModel *model)
set graph model to edit
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 _rename()
rename selected node
void addModelActions()
Add model specific buttons onto toolbar.
bool prefixValid() const
Check prefix.
void addNode(QString type)
add instance of given type
bool deleteNode(QString nodename, bool draw=true)
delete node
Definition: GraphModel.cpp:301
void _delete()
delete selected node
void renameNode(QString nodename, bool draw=true)
rename node
Definition: GraphModel.cpp:264
GraphModel * _model
used graph model
Definition: ModelToolBar.h:74
ModelToolBar(const QString &title, QWidget *parent=0)
default constructor
void _disconnect()
disconnect selected node