SemanticGraphGlobalItem.cpp
Go to the documentation of this file.
1
#include "
SemanticGraphGlobalItem.h
"
2
3
#include <QGraphicsSceneContextMenuEvent>
4
#include <QPainter>
5
6
#include <
ArmarXCore/core/logging/Logging.h
>
7
8
namespace
armarx
9
{
10
11
SemanticGraphGlobalItem::SemanticGraphGlobalItem
()
12
{
13
}
14
15
void
16
SemanticGraphGlobalItem::paint
(QPainter* painter,
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
option
#define option(type, fn)
Logging.h
SemanticGraphGlobalItem.h
armarx::SemanticGraphGlobalItem::SemanticGraphGlobalItem
SemanticGraphGlobalItem()
Definition
SemanticGraphGlobalItem.cpp:11
armarx::SemanticGraphGlobalItem::borderColor
QColor borderColor
Definition
SemanticGraphGlobalItem.h:25
armarx::SemanticGraphGlobalItem::onLeftClick
void onLeftClick(SemanticGraphGlobalItem *)
armarx::SemanticGraphGlobalItem::fontColor
QColor fontColor
Definition
SemanticGraphGlobalItem.h:26
armarx::SemanticGraphGlobalItem::text
QString text
Definition
SemanticGraphGlobalItem.h:21
armarx::SemanticGraphGlobalItem::selected
bool selected
Definition
SemanticGraphGlobalItem.h:22
armarx::SemanticGraphGlobalItem::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Definition
SemanticGraphGlobalItem.cpp:50
armarx::SemanticGraphGlobalItem::fillColor
QColor fillColor
Definition
SemanticGraphGlobalItem.h:24
armarx::SemanticGraphGlobalItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Definition
SemanticGraphGlobalItem.cpp:16
ARMARX_VERBOSE
#define ARMARX_VERBOSE
The logging level for verbose information.
Definition
Logging.h:187
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition
ArmarXTimeserver.cpp:28
VisionX
gui-plugins
SemanticRelationViewer
SemanticGraphGlobalItem.cpp
Generated by
1.13.2