IntEnumWidget.h
Go to the documentation of this file.
1#pragma once
2
3#include <QComboBox>
4
7
9#include "CustomWidget.h"
10
11namespace armarx
12{
13 // Custom wrapper around the QComboBox widget to represent IntEnums
14 // This class handles parsing once the user edited the field and is also responsible
15 // to parse the according aron data from text
17 {
18 Q_OBJECT
19 public:
20 IntEnumWidget(const aron::type::IntEnumPtr&, QTreeWidgetItem* currentItem);
21 // needs to be called after the constructor, because qt needs the meta object to be fully constructed at this point
23
24 static IntEnumWidget* DynamicCast(QWidget*);
25 static IntEnumWidget* DynamicCastAndCheck(QWidget*);
26
27 bool hasParseErrors();
28 void setText(const QString& text);
29 QString getText();
30 std::pair<bool, aron::data::IntPtr> parseToAron();
31
32 private:
33 const aron::type::IntEnumPtr element_type;
34 QComboBox* innerWidget;
35
36 bool noParseErrors = true;
37
38 void highlightUnparsableEntries();
39 private slots:
40 void textChanged(const QString&);
41 };
42} // namespace armarx
CustomWidget(QTreeWidgetItem *overlayingItem)
void setText(const QString &text)
IntEnumWidget(const aron::type::IntEnumPtr &, QTreeWidgetItem *currentItem)
static IntEnumWidget * DynamicCastAndCheck(QWidget *)
std::pair< bool, aron::data::IntPtr > parseToAron()
static IntEnumWidget * DynamicCast(QWidget *)
std::shared_ptr< IntEnum > IntEnumPtr
Definition IntEnum.h:36
This file offers overloads of toIce() and fromIce() functions for STL container types.