28 #include <QTextStream>
30 #include <QPainterPath>
48 setFlag(QGraphicsItem::ItemIsMovable);
49 setFlag(QGraphicsItem::ItemIsSelectable);
90 bb.adjust(-1,-1,+1,+1);
109 QMapIterator<QString,NodeProperty*> i(
_properties);
112 curProp = i.next().value();
118 QGraphicsItem::mouseMoveEvent(ev);
120 qreal dx = (ev->scenePos()-ev->lastScenePos()).x();
121 qreal dy = (ev->scenePos()-ev->lastScenePos()).y();
122 foreach (QGraphicsItem* cur, childItems()) {
133 QString posString = QString(
"%1 %2").arg(pos().x()).arg(pos().y());
138 QPainter* painter,
const QStyleOptionGraphicsItem*, QWidget*) {
139 painter->setPen(QPen(Qt::black,1.f));
140 painter->setOpacity(1);
143 painter->setBrush(Qt::red);
146 painter->setBrush(
_selectedNode ? QColor(
"#AAF") : QColor(
"#BBC"));
147 painter->drawRoundedRect(0,0,
_width,22,10,10);
149 painter->setPen(Qt::black);
151 QFont f = painter->font();
154 f.setCapitalization(QFont::SmallCaps);
157 f.setCapitalization(QFont::MixedCase);
void setName(QString name)
resets the name of the node
void setSelectedNode(bool s)
sets the node selected or not
This model wraps a ParameterFile instance and provides access to the data interpreted as a (directed)...
int getHeight() const
node height
unsigned int _id
id of the node
bool isSelectedNode()
state of node selections
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
paints the node
Declaration of class Node.
Declaration of class GraphModel.
void addProperty(QString name, bool input)
adds a property to the node
void setClassName(QString modname)
set node class name
void changeConnectionLineColor(QColor lineColor)
change color of connected line
int _nProps
number of properties in node
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
handles mouse move events
QMap< QString, NodeProperty * > _properties
list of nodeproperties
This model serves to provide a model frontend to access a ParameterFile instance. ...
QString getClassName() const
get class name
NodeProperty * getProperty(QString propName) const
get node property
int getWidth() const
node width
static unsigned int _idCount
static id counter for id creation
void moveBy(qreal dx, qreal dy)
moves the property and if connected all connectionlines
GraphModel * model()
get the current GraphModel
int _height
height of the node
bool _selectedNode
state of node selection
QRectF boundingRect() const
area where node is clickable
unsigned int getId() const
get node id
Property(/Parameter) of a node.
void setActive(bool activeStatus)
changes the nodes activity
QString getInstanceName()
get node name
int _width
width of the node
void setValue(QString parName, QString value)
Set a parameter in the underlying parameter file.
const ParameterFileModel * _pFile
link to parameter file
Declaration of class NodeHandler.
QString _className
name of the module the node is representing
QGraphicsScene that handles all drag&drop, node move and connect events.
void _checkWidth(int nChars=0)
checks the node width in reference to the node name
QString _instanceName
name of the node
void setId(unsigned int id)
sets the id of the node
void changeConnectionLineColor(QColor lineColor, bool isHover=true)
change color all connected line of hovering property isHover set to true when the property was hovere...
bool _active
state of activity
Node(const ParameterFileModel *pFile, QString title, int xpos, int ypos)
default constructor