SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
qtGroupingNode.h
1 //=========================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //=========================================================================
10 #ifndef smtk_extension_qtGroupingNode_h
11 #define smtk_extension_qtGroupingNode_h
12 
13 #include "smtk/extension/qt/Exports.h"
14 #include "smtk/extension/qt/diagram/qtBaseNode.h"
15 
16 #include "smtk/common/UUID.h"
17 
18 #include "smtk/PublicPointerDefs.h"
19 
20 #include <QGraphicsItem>
21 #include <QGraphicsScene>
22 
23 class QAbstractItemModel;
24 class QGraphicsTextItem;
25 class QItemSelection;
26 class QTreeView;
27 
28 namespace smtk
29 {
30 namespace extension
31 {
32 
33 class qtDiagramGenerator;
34 class GroupingNodeWidget;
35 
40 class SMTKQTEXT_EXPORT qtGroupingNode : public qtBaseNode
41 {
42  Q_OBJECT
43  Q_INTERFACES(QGraphicsItem);
44  Q_PROPERTY(QPointF pos READ pos WRITE setPos);
45  Q_PROPERTY(qreal rotation READ rotation WRITE setRotation);
46 
47 public:
50 
52  qtDiagramGenerator* generator,
53  smtk::string::Token groupName,
54  QGraphicsItem* parent = nullptr);
56  const smtk::common::UUID& uid,
57  const std::array<double, 2>& location,
58  qtDiagramGenerator* generator,
59  smtk::string::Token groupName,
60  QGraphicsItem* parent = nullptr);
61  ~qtGroupingNode() override = default;
62 
63  smtk::common::UUID nodeId() const override;
64 
66  QRectF boundingRect() const override;
67 
69  void dataUpdated() override;
70 
72  smtk::string::Token groupName() const { return m_group; }
73 
77  bool setLabel(smtk::string::Token label);
78  smtk::string::Token label() const;
79 
83  std::string name() const override;
84 
85 protected:
86  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
87 
89  void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
90  void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
91 
93  int updateSize() override;
94 
95  smtk::string::Token m_group;
96  smtk::string::Token m_label;
97  smtk::common::UUID m_id;
98 };
99 
100 } // namespace extension
101 } // namespace smtk
102 
103 #endif // smtk_extension_qtGroupingNode_h
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
smtk::extension::qtGroupingNode::groupName
smtk::string::Token groupName() const
Return the group name string-token.
Definition: qtGroupingNode.h:72
PublicPointerDefs.h
smtk::extension::qtGroupingNode
Rendering and interaction code for nodes that represent groups of resource and component nodes.
Definition: qtGroupingNode.h:40
smtk::extension::qtBaseNode
A Graphical Item that represents a node connected by arcs in a scene.
Definition: qtBaseNode.h:47
smtk::common::UUID
Definition: UUID.h:38
smtkTypeMacro
#define smtkTypeMacro(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:148
smtkSuperclassMacro
#define smtkSuperclassMacro(...)
Add a typedef to the superclass of this class.
Definition: SharedFromThis.h:167
smtk::string::Token
A string token identified by an integer.
Definition: Token.h:29
smtk::extension::qtDiagramGenerator
A base class that maintains a diagram in the face of operations which modify the state of the diagram...
Definition: qtDiagramGenerator.h:43