AronTreeWidgetContextMenu.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 #include <QAction>
5 
9 
10 class QTreeWidget;
11 class QPoint;
12 
13 namespace armarx::skills::gui
14 {
15 
16  class AronTreeWidgetItem;
17 
18  // Visitor on aron types. It creates a context menu dependent on the type of the AronTreeWidgetItem.
19  // Its only used for Lists and Dicts.
21  {
22 
23  AronTreeWidgetItem* parentItem;
24  QTreeWidget* contextMenuParent;
25  const QPoint& pos;
26  int index;
27 
28  public:
31  const QPoint& pos,
32  QTreeWidget* contextMenuParent,
33  int x);
34 
35  void visitAronVariant(const aron::type::ObjectPtr&) final;
36  void visitAronVariant(const aron::type::DictPtr&) final;
37  void visitAronVariant(const aron::type::PairPtr&) final;
38  void visitAronVariant(const aron::type::TuplePtr&) final;
39  void visitAronVariant(const aron::type::ListPtr&) final;
40  void visitAronVariant(const aron::type::NDArrayPtr&) final;
41  void visitAronVariant(const aron::type::MatrixPtr&) final;
43  void visitAronVariant(const aron::type::ImagePtr&) final;
45  void visitAronVariant(const aron::type::IntEnumPtr&) final;
46  void visitAronVariant(const aron::type::IntPtr&) final;
47  void visitAronVariant(const aron::type::LongPtr&) final;
48  void visitAronVariant(const aron::type::FloatPtr&) final;
49  void visitAronVariant(const aron::type::DoublePtr&) final;
50  void visitAronVariant(const aron::type::BoolPtr&) final;
51  void visitAronVariant(const aron::type::StringPtr&) final;
52  void visitUnknown(Input&) final;
53 
54  void showMenuAndExecute();
55 
56  private:
57  std::list<QAction> actions;
58  std::vector<std::function<void()>> action_callbacks;
59 
60  // Creates a remove option if the element is a direct child of a list or dict
61  void addDeleteAction();
62  void executeDelete();
63 
64  void addAddAction();
65  void executeAddElement();
66  };
67 } // namespace armarx::skills::gui
armarx::aron::type::VisitorBase< const type::VariantPtr >::Input
const type::VariantPtr Input
Definition: Visitor.h:94
armarx::aron::type::MatrixPtr
std::shared_ptr< class Matrix > MatrixPtr
Definition: forward_declarations.h:20
VariantVisitor.h
armarx::aron::type::ImagePtr
std::shared_ptr< class Image > ImagePtr
Definition: forward_declarations.h:22
armarx::aron::type::NDArrayPtr
std::shared_ptr< class NDArray > NDArrayPtr
Definition: forward_declarations.h:19
armarx::skills::gui::AronTreeWidgetContextMenuVisitor::showMenuAndExecute
void showMenuAndExecute()
Definition: AronTreeWidgetContextMenu.cpp:214
All.h
armarx::aron::type::TuplePtr
std::shared_ptr< class Tuple > TuplePtr
Definition: forward_declarations.h:17
armarx::aron::type::PointCloudPtr
std::shared_ptr< class PointCloud > PointCloudPtr
Definition: forward_declarations.h:23
armarx::aron::type::FloatPtr
std::shared_ptr< class Float > FloatPtr
Definition: forward_declarations.h:29
armarx::aron::type::ListPtr
std::shared_ptr< class List > ListPtr
Definition: forward_declarations.h:14
armarx::aron::type::LongPtr
std::shared_ptr< class Long > LongPtr
Definition: forward_declarations.h:28
armarx::aron::type::StringPtr
std::shared_ptr< class String > StringPtr
Definition: forward_declarations.h:31
armarx::skills::gui::AronTreeWidgetContextMenuVisitor::visitUnknown
void visitUnknown(Input &) final
Definition: AronTreeWidgetContextMenu.cpp:208
All.h
armarx::aron::type::PairPtr
std::shared_ptr< class Pair > PairPtr
Definition: forward_declarations.h:16
armarx::aron::type::DictPtr
std::shared_ptr< class Dict > DictPtr
Definition: forward_declarations.h:13
armarx::skills::gui
Definition: PeriodicUpdateWidget.cpp:11
armarx::aron::type::BoolPtr
std::shared_ptr< class Bool > BoolPtr
Definition: forward_declarations.h:32
armarx::aron::type::IntEnumPtr
std::shared_ptr< IntEnum > IntEnumPtr
Definition: IntEnum.h:36
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx::aron::type::ConstVariantVisitor
The VariantVisitor struct.
Definition: VariantVisitor.h:38
armarx::skills::gui::AronTreeWidgetItem
Definition: AronTreeWidgetItem.h:19
armarx::aron::type::QuaternionPtr
std::shared_ptr< class Quaternion > QuaternionPtr
Definition: forward_declarations.h:21
armarx::aron::type::IntPtr
std::shared_ptr< class Int > IntPtr
Definition: forward_declarations.h:27
armarx::skills::gui::AronTreeWidgetContextMenuVisitor::AronTreeWidgetContextMenuVisitor
AronTreeWidgetContextMenuVisitor()=delete
armarx::aron::type::DoublePtr
std::shared_ptr< class Double > DoublePtr
Definition: forward_declarations.h:30
armarx::skills::gui::AronTreeWidgetContextMenuVisitor::visitAronVariant
void visitAronVariant(const aron::type::ObjectPtr &) final
Definition: AronTreeWidgetContextMenu.cpp:69
armarx::skills::gui::AronTreeWidgetContextMenuVisitor
Definition: AronTreeWidgetContextMenu.h:20