SemanticGraphVertexItem.cpp
Go to the documentation of this file.
1
#include "
SemanticGraphVertexItem.h
"
2
3
#include <QGraphicsSceneContextMenuEvent>
4
#include <QPainter>
5
6
#include <
ArmarXCore/core/logging/Logging.h
>
7
8
namespace
armarx
9
{
10
11
void
12
SemanticGraphVertexItem::paint
(QPainter* painter,
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
option
#define option(type, fn)
Logging.h
SemanticGraphVertexItem.h
armarx::SemanticGraphVertexItem::borderColor
QColor borderColor
Definition
SemanticGraphVertexItem.h:26
armarx::SemanticGraphVertexItem::fontColor
QColor fontColor
Definition
SemanticGraphVertexItem.h:27
armarx::SemanticGraphVertexItem::text
QString text
Definition
SemanticGraphVertexItem.h:19
armarx::SemanticGraphVertexItem::onLeftClick
void onLeftClick(SemanticGraphVertexItem *)
armarx::SemanticGraphVertexItem::selected
bool selected
Definition
SemanticGraphVertexItem.h:20
armarx::SemanticGraphVertexItem::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Definition
SemanticGraphVertexItem.cpp:46
armarx::SemanticGraphVertexItem::fillColor
QColor fillColor
Definition
SemanticGraphVertexItem.h:25
armarx::SemanticGraphVertexItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Definition
SemanticGraphVertexItem.cpp:12
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
SemanticGraphVertexItem.cpp
Generated by
1.13.2