27 #include <QCoreApplication>
35 Node* parentNode, QString name,
int propNr,
37 QGraphicsItem(parentNode),
46 setAcceptHoverEvents(
true);
51 Node* parentNode, QString name,QString displayname,
int propNr,
53 QGraphicsItem(parentNode),
56 _displayname(displayname),
62 setAcceptHoverEvents(
true);
85 tt.replace(
"<",
"<").replace(
">",
">");
97 ret.adjust(1,5,-1,-5);
99 ret.setRight(ret.left()+11);
102 ret.setLeft(ret.right()-11);
112 QPainter* painter,
const QStyleOptionGraphicsItem*, QWidget*) {
114 inner.adjust(12,0,-12,0);
115 painter->setPen(QPen(Qt::black,0.5f));
116 painter->setOpacity(1);
118 painter->setBrush(
_color);
119 painter->drawRoundRect(inner, 10, 100);
120 painter->setBrush(Qt::black);
121 inner.adjust(10,0,-10,0);
122 QFont f = painter->font();
142 while (cl.hasNext()) {
143 connectedLine=cl.next();
148 cNodes << QString(
"%1: <code>%2</code>")
151 if (cNodes.isEmpty()) {
152 cNodes << QString(
"<i>%1</i>").arg(
153 QCoreApplication::translate(
"NodeProperty",
"no connections"));
156 "<p style='white-space:pre'>"
157 "<b>%11: <i>%1</i></b><br>"
158 "<b>%12:</b><br><code>%2</code><br>"
159 "<b>%13:</b><br>%3<br>"
160 "<b>%14:</b><br>%4</p>")
164 .arg(cNodes.join(
"<br>"))
165 .arg(QCoreApplication::translate(
"NodeProperty",
"slot"))
166 .arg(QCoreApplication::translate(
"NodeProperty",
"type"))
167 .arg(QCoreApplication::translate(
"NodeProperty",
"documentation"))
168 .arg(QCoreApplication::translate(
"NodeProperty",
"connected to")));
172 QGraphicsItem::hoverEnterEvent(ev);
178 QGraphicsItem::hoverLeaveEvent(ev);
184 while (cl.hasNext()) {
185 connectedLine = cl.next();
208 if (tName.contains(
"cimg",Qt::CaseInsensitive)) {
211 else if (tName.contains(
"vigra",Qt::CaseInsensitive)) {
212 return Qt::darkYellow;
214 else if(tName.contains(
"roi",Qt::CaseInsensitive)) {
217 else if(tName.contains(
"interpolator",Qt::CaseInsensitive)) {
QString _name
name of the property
QString _displayname
name of the property
bool isSelectedNode()
state of node selections
QGraphicsItem that contains nodeproperties and draws the node.
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
update tool tip
Declaration of class ParameterFileModel.
NodeProperty * getEndProp() const
get property at end of line
Declaration of class Node.
NodeProperty * getStartProp() const
get property at start of line
bool _isInput
pointer to PropType of the property
Declaration of class GraphModel.
void setLineColor(const QColor &newColor)
set color connected line
QPointF getSocketCenter() const
socket center including node position
Declaration of class NodeProperty.
void addConnection(ConnectionLine *cl)
add a connectionline to the property
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
draws the property
bool isInput() const
returns the PropType of the property
This model serves to provide a model frontend to access a ParameterFile instance. ...
QString getFullName() const
property name including node instance name
int getWidth() const
node width
void setStartPoint(int x, int y)
sets start point (for drawing)
Declaration of class ConnectionLine.
QList< ConnectionLine * > _connectionList
list of all connectionlines
static QColor _getSocketColor(QString typeName)
get color from type
void moveBy(qreal dx, qreal dy)
moves the property and if connected all connectionlines
Line that connects two slots of two different nodes.
QColor _color
Socket color.
QString getDoc(QString parName) const
pass to metaInfo, use dynamic metadata if needed
unsigned int _propNr
number of property
Property(/Parameter) of a node.
virtual QRectF boundingRect() const
area for hover event
QString getInstanceName()
get node name
QRectF _getSocketRect() const
center of the socket, used to draw end and start of connectionline
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
clear color of connected line when leave hoverevent
Declaration of class NodeHandler.
QString getType(QString parName, bool applyTmplType=true) const
Get type of some parameter or slot.
void setColor(QColor socketColor)
Set the color of the socket.
const ParameterFileModel * _pFile
link to parameter file
void setEndPoint(int x, int y)
sets end point (for drawing)
QString getType() const
get property type
void changeConnectionLineColor(QColor lineColor, bool isHover=true)
change color all connected line of hovering property isHover set to true when the property was hovere...
Node * _node
pointer to parent node
NodeProperty(Node *parentNode, QString name, int propNr, bool input, const ParameterFileModel *pFile)
default constructor