AronTreeWidgetCreator.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 RobotAPI::gui-plugins::SkillManagerMonitorWidgetController
17 * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * @date 2020
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22#pragma once
23
24#include <QTreeWidgetItem>
25
29
30namespace armarx
31{
33
34 // Convert aron type to tree widgets
36 {
37 public:
39
41
42 // Takes the parent tree element and attaches the newly crated object during visit() to it.
43 // This allows us to also use information of the parent object during creation (like if this child is a dict entry or part of a list)
44 // IMPORTANT: For the root element, manually set the topLevelWidget after this constructor
45 AronTreeWidgetCreatorVisitor(QTreeWidgetItem* parentInstance);
46
47 void insertNewTreeViewWidget(Input& i, const std::string&);
48
49
50 void visitAronVariant(const aron::type::ObjectPtr&) final;
51 void visitAronVariant(const aron::type::DictPtr& i) final;
52 void visitAronVariant(const aron::type::PairPtr& i) final;
53 void visitAronVariant(const aron::type::TuplePtr& i) final;
54 void visitAronVariant(const aron::type::ListPtr& i) final;
55 void visitAronVariant(const aron::type::NDArrayPtr& i) final;
56 void visitAronVariant(const aron::type::MatrixPtr& i) final;
58 void visitAronVariant(const aron::type::ImagePtr& i) final;
60 void visitAronVariant(const aron::type::IntEnumPtr& i) final;
61 void visitAronVariant(const aron::type::IntPtr& i) final;
62 void visitAronVariant(const aron::type::LongPtr& i) final;
63 void visitAronVariant(const aron::type::FloatPtr& i) final;
64 void visitAronVariant(const aron::type::DoublePtr& i) final;
65 void visitAronVariant(const aron::type::BoolPtr& i) final;
66 void visitAronVariant(const aron::type::StringPtr& i) final;
67 void visitUnknown(Input&) final;
68
69 // setter for the widget attachment point. Only needs to be manually set for the root element.
70 void setTopLevelWidget(QTreeWidget* widget);
71
72 private:
73 void handleEditable();
74 std::string generateUniqueKeyFromSet(std::set<std::string>&& usedKeys);
75 QTreeWidgetItem* parentOfCreatedObj = nullptr;
76 QTreeWidget* toplevelWidget = nullptr;
77 const std::string defaultMapKeyName = "key_";
78 // controls, if values (column 1) can be edited directly
79 bool editableValue = false;
80 };
81} // namespace armarx
void insertNewTreeViewWidget(Input &i, const std::string &)
void visitAronVariant(const aron::type::ObjectPtr &) final
std::shared_ptr< class Quaternion > QuaternionPtr
std::shared_ptr< Object > ObjectPtr
Definition Object.h:36
std::shared_ptr< class Double > DoublePtr
std::shared_ptr< class Matrix > MatrixPtr
std::shared_ptr< class Image > ImagePtr
std::shared_ptr< class Long > LongPtr
std::shared_ptr< class String > StringPtr
std::shared_ptr< class PointCloud > PointCloudPtr
std::shared_ptr< class Pair > PairPtr
std::shared_ptr< class NDArray > NDArrayPtr
std::shared_ptr< class Int > IntPtr
std::shared_ptr< class Float > FloatPtr
std::shared_ptr< class Bool > BoolPtr
std::shared_ptr< class Tuple > TuplePtr
std::shared_ptr< class Dict > DictPtr
std::shared_ptr< IntEnum > IntEnumPtr
Definition IntEnum.h:36
std::shared_ptr< class List > ListPtr
This file offers overloads of toIce() and fromIce() functions for STL container types.
typename VisitorBase< const type::VariantPtr >::Input Input
Definition Visitor.h:103