TGuiComponentBase.h
Go to the documentation of this file.
1 #ifndef iqtgui_TGuiComponentBase_included
2 #define iqtgui_TGuiComponentBase_included
3 
4 
5 // Qt includes
6 #include <QtCore/QtGlobal>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QWidget>
9 #else
10 #include <QtGui/QWidget>
11 #endif
12 
13 
14 // ACF includes
16 
17 
18 namespace iqtgui
19 {
20 
21 
24 template <class WidgetType>
26 {
27 public:
29 
31 
32  virtual WidgetType* GetQtWidget() const;
33 
34  // reimplemented (iqtgui::CGuiComponentBase)
35  virtual QWidget* CreateQtWidget(QWidget* parentPtr);
36 };
37 
38 
39 // public methods
40 
41 template <class WidgetType>
43 {
44 }
45 
46 
47 template <class WidgetType>
49 {
50  return dynamic_cast<WidgetType*>(GetWidget());
51 }
52 
53 
54 // reimplemented (iqtgui::CGuiComponentBase)
55 
56 template <class WidgetType>
58 {
59  Q_ASSERT(!IsGuiCreated());
60 
61  WidgetType* widgetPtr = new WidgetType(parentPtr);
62 
63  return widgetPtr;
64 }
65 
66 
67 } // namespace iqtgui
68 
69 
70 #endif // !iqtgui_TGuiComponentBase_included
71 
72 
Base class for classes implementing interface iqtgui::IGuiObject.
Base class for all Qt GUI componentes.
virtual QWidget * CreateQtWidget(QWidget *parentPtr)
Create slave widget object.
CGuiComponentBase BaseClass
virtual WidgetType * GetQtWidget() const

© 2007-2017 Witold Gantzke and Kirill Lepskiy