TermNodeGraphicsItem.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::Gui
17 * @author Kai Welke (welke@kit.edu)
18 * @copyright 2012 Humanoids Group, IAIM, IFA
19 * @license http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 #include "../TermNode.h"
26 
27 #include <QGraphicsItem>
28 #include <QString>
29 #include <QPainter>
30 
31 namespace armarx
32 {
33  class TermNodeGraphicsItem : public QObject, public QGraphicsItem
34  {
35  Q_OBJECT
36 
37  public:
38  // constructs a termnode graphics item
40 
41  // set the position of the node
42  void setRect(QRectF boundingBox);
43  void setText(const QString& text);
44  void setPixmap(const QPixmap& pixmap);
45  void setColor(const QColor& penColor);
46 
47  // pute virtual in QGraphicsItem
48  QRectF boundingRect() const override;
49  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
50  QWidget* widget) override;
51 
52  signals:
53  void nodeActivated();
54  void nodeDeactivated();
55 
56  public slots:
57  void updateNodeActivation(const QPointF&);
58  void activateNode();
59  void deactivateNode();
60  void activateNodeSilent();
61 
62  private:
63  TermNode* node;
64  QString text;
65  QRectF boundingBox;
66  QPixmap pixmap;
67  QColor penColor;
68  bool pixmapSet;
69  bool activated;
70  };
71 }
72 
armarx::TermNodeGraphicsItem::boundingRect
QRectF boundingRect() const override
Definition: TermNodeGraphicsItem.cpp:69
armarx::TermNodeGraphicsItem
Definition: TermNodeGraphicsItem.h:33
armarx::TermNodeGraphicsItem::nodeDeactivated
void nodeDeactivated()
armarx::TermNodeGraphicsItem::activateNodeSilent
void activateNodeSilent()
Definition: TermNodeGraphicsItem.cpp:123
armarx::TermNodeGraphicsItem::setPixmap
void setPixmap(const QPixmap &pixmap)
Definition: TermNodeGraphicsItem.cpp:60
armarx::TermNodeGraphicsItem::nodeActivated
void nodeActivated()
armarx::TermNodeGraphicsItem::deactivateNode
void deactivateNode()
Definition: TermNodeGraphicsItem.cpp:128
armarx::TermNodeGraphicsItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Definition: TermNodeGraphicsItem.cpp:74
armarx::TermTreeGraphicsScene
Definition: TermTreeGraphicsScene.h:32
armarx::TermNodeGraphicsItem::setText
void setText(const QString &text)
Definition: TermNodeGraphicsItem.cpp:46
option
#define option(type, fn)
armarx::TermNodeGraphicsItem::TermNodeGraphicsItem
TermNodeGraphicsItem(TermTreeGraphicsScene *scene, TermNode *node)
Definition: TermNodeGraphicsItem.cpp:27
armarx::TermNodeGraphicsItem::setColor
void setColor(const QColor &penColor)
Definition: TermNodeGraphicsItem.cpp:53
armarx::TermNodeGraphicsItem::updateNodeActivation
void updateNodeActivation(const QPointF &)
Definition: TermNodeGraphicsItem.cpp:135
armarx::TermNodeGraphicsItem::activateNode
void activateNode()
Definition: TermNodeGraphicsItem.cpp:116
armarx::TermNode
Definition: TermNode.h:47
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::TermNodeGraphicsItem::setRect
void setRect(QRectF boundingBox)
Definition: TermNodeGraphicsItem.cpp:38