CustomWidget.cpp
Go to the documentation of this file.
1 #include "CustomWidget.h"
2 
4 
5 namespace armarx
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
armarx::CustomWidget::CustomWidget
CustomWidget(QTreeWidgetItem *overlayingItem)
Definition: CustomWidget.cpp:7
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::CustomWidget::elemChanged
void elemChanged(QTreeWidgetItem *elem, int col)
armarx::CustomWidget::setSupressSignals
virtual void setSupressSignals(bool doSupress)
Definition: CustomWidget.cpp:36
CustomWidget.h
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
armarx::CustomWidget::overlayingItem
QTreeWidgetItem * overlayingItem
Definition: CustomWidget.h:21
armarx::CustomWidget::DynamicCastAndCheck
static CustomWidget * DynamicCastAndCheck(QWidget *)
Definition: CustomWidget.cpp:24
ExpressionException.h
armarx::CustomWidget
Definition: CustomWidget.h:9
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::CustomWidget::DynamicCast
static CustomWidget * DynamicCast(QWidget *)
Definition: CustomWidget.cpp:18