IntEnumWidget.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QComboBox>
4 
7 
8 #include "../AronTreeWidgetItem.h"
9 #include "CustomWidget.h"
10 
11 namespace 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
16  class IntEnumWidget : public CustomWidget
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
22  void postCtorCall();
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
armarx::IntEnumWidget::DynamicCastAndCheck
static IntEnumWidget * DynamicCastAndCheck(QWidget *)
Definition: IntEnumWidget.cpp:44
armarx::IntEnumWidget::hasParseErrors
bool hasParseErrors()
Definition: IntEnumWidget.cpp:56
armarx::IntEnumWidget
Definition: IntEnumWidget.h:16
CustomWidget.h
armarx::IntEnumWidget::IntEnumWidget
IntEnumWidget(const aron::type::IntEnumPtr &, QTreeWidgetItem *currentItem)
Definition: IntEnumWidget.cpp:12
Int.h
armarx::IntEnumWidget::DynamicCast
static IntEnumWidget * DynamicCast(QWidget *)
Definition: IntEnumWidget.cpp:38
armarx::IntEnumWidget::getText
QString getText()
Definition: IntEnumWidget.cpp:69
armarx::IntEnumWidget::setText
void setText(const QString &text)
Definition: IntEnumWidget.cpp:62
forward_declarations.h
armarx::CustomWidget
Definition: CustomWidget.h:9
armarx::aron::type::IntEnumPtr
std::shared_ptr< IntEnum > IntEnumPtr
Definition: IntEnum.h:36
armarx::IntEnumWidget::parseToAron
std::pair< bool, aron::data::IntPtr > parseToAron()
Definition: IntEnumWidget.cpp:75
armarx::IntEnumWidget::postCtorCall
void postCtorCall()
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28