CustomWidget.cpp
Go to the documentation of this file.
1 #include "CustomWidget.h"
2 
4 
5 namespace armarx::skills::gui
6 {
7  CustomWidget::CustomWidget(QTreeWidgetItem* overlayingItem) : overlayingItem(overlayingItem)
8  {
9  // connect to general QTreeWidgetItem callback.
10  // This also lets the conversion start for other objects. (Not just this widget)
11  ARMARX_CHECK(connect(this,
12  SIGNAL(elemChanged(QTreeWidgetItem*, int)),
13  overlayingItem->treeWidget(),
14  SIGNAL(itemChanged(QTreeWidgetItem*, int))));
15  }
16 
19  {
20  return dynamic_cast<CustomWidget*>(elem);
21  }
22 
25  {
26  if (!elem)
27  {
28  return nullptr;
29  }
30  auto* casted = DynamicCast(elem);
31  ARMARX_CHECK_NOT_NULL(casted);
32  return casted;
33  }
34 
35  void
37  {
38  QObject::blockSignals(doSupress);
39  }
40 
41 
42 } // namespace armarx::skills::gui
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::skills::gui::CustomWidget::DynamicCast
static CustomWidget * DynamicCast(QWidget *)
Definition: CustomWidget.cpp:18
armarx::skills::gui::CustomWidget::overlayingItem
QTreeWidgetItem * overlayingItem
Definition: CustomWidget.h:21
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
CustomWidget.h
armarx::skills::gui
Definition: PeriodicUpdateWidget.cpp:11
armarx::skills::gui::CustomWidget::CustomWidget
CustomWidget(QTreeWidgetItem *overlayingItem)
Definition: CustomWidget.cpp:7
armarx::skills::gui::CustomWidget::elemChanged
void elemChanged(QTreeWidgetItem *elem, int col)
armarx::skills::gui::CustomWidget::setSupressSignals
virtual void setSupressSignals(bool doSupress)
Definition: CustomWidget.cpp:36
armarx::skills::gui::CustomWidget
Definition: CustomWidget.h:9
ExpressionException.h
armarx::skills::gui::CustomWidget::DynamicCastAndCheck
static CustomWidget * DynamicCastAndCheck(QWidget *)
Definition: CustomWidget.cpp:24