SemanticGraphVertexItem.cpp
Go to the documentation of this file.
2
3#include <QGraphicsSceneContextMenuEvent>
4#include <QPainter>
5
7
8namespace armarx
9{
10
11 void
13 const QStyleOptionGraphicsItem* option,
14 QWidget* widget)
15 {
16 if (selected)
17 {
18 this->setPen(QPen(borderColor, 4.0f));
19 this->setBrush(QBrush(fillColor));
20 }
21 else
22 {
23 this->setPen(QPen(borderColor, 2.0f));
24 this->setBrush(QBrush(fillColor));
25 }
26 QGraphicsEllipseItem::paint(painter, option, widget);
27
28 // Add text to the ellipse
29 QRectF rect = this->rect();
30 painter->setPen(fontColor);
31
32 QFont font;
33 if (selected)
34 {
35 font.setBold(true);
36 }
37 else
38 {
39 font.setBold(false);
40 }
41 painter->setFont(font);
42 painter->drawText(rect, Qt::AlignCenter, text);
43 }
44
45 void
46 SemanticGraphVertexItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
47 {
48 ARMARX_VERBOSE << "Pressed node: " << text.toStdString();
49 if (event->button() == Qt::LeftButton)
50 {
51 emit onLeftClick(this);
52 }
53 }
54
55} // namespace armarx
#define option(type, fn)
void onLeftClick(SemanticGraphVertexItem *)
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
#define ARMARX_VERBOSE
The logging level for verbose information.
Definition Logging.h:187
This file offers overloads of toIce() and fromIce() functions for STL container types.