SemanticGraphGlobalItem.cpp
Go to the documentation of this file.
2
3#include <QGraphicsSceneContextMenuEvent>
4#include <QPainter>
5
7
8namespace armarx
9{
10
14
15 void
17 const QStyleOptionGraphicsItem* option,
18 QWidget* widget)
19 {
20 if (selected)
21 {
22 this->setPen(QPen(borderColor, 4.0f));
23 this->setBrush(QBrush(fillColor));
24 }
25 else
26 {
27 this->setPen(QPen(borderColor, 2.0f));
28 this->setBrush(QBrush(fillColor));
29 }
30 QGraphicsRectItem::paint(painter, option, widget);
31
32 // Add text to the ellipse
33 QRectF rect = this->rect();
34 painter->setPen(fontColor);
35
36 QFont font;
37 if (selected)
38 {
39 font.setBold(true);
40 }
41 else
42 {
43 font.setBold(false);
44 }
45 painter->setFont(font);
46 painter->drawText(rect, Qt::AlignCenter, text);
47 }
48
49 void
50 SemanticGraphGlobalItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
51 {
52 ARMARX_VERBOSE << "Pressed node: " << text.toStdString();
53 if (event->button() == Qt::LeftButton)
54 {
55 emit onLeftClick(this);
56 }
57 }
58
59} // namespace armarx
#define option(type, fn)
void onLeftClick(SemanticGraphGlobalItem *)
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.