scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

SciDAVisObject.h
Go to the documentation of this file.
1 #ifndef SCIDAVISOBJECT_H
2 #define SCIDAVISOBJECT_H
3 
6 template <class Base>
7 class SciDAVisObject: public Base
8 {
9  void m_setParent(QObject* child, QObject* parent)
10  {child->setParent(parent);}
11  // overload that preserves the default window flags
12  void m_setParent(QWidget* child, QWidget* parent)
13  {child->setParent(parent,child->windowFlags());}
14 
15 public:
16  template <class... A>
17  SciDAVisObject(A... args): Base(std::forward<A>(args)...) {}
18 
20  template <class T, class... A>
21  T& addChild(A... args) {
22  T* child=new T(std::forward<A>(args)...);
23  m_setParent(child,this);
24  return *child;
25  }
26 };
27 
28 #endif
SciDAVisObject
Definition: SciDAVisObject.h:8
SciDAVisObject::m_setParent
void m_setParent(QObject *child, QObject *parent)
Definition: SciDAVisObject.h:9
SciDAVisObject::addChild
T & addChild(A... args)
generic factory function to add a child object, to avoid bare pointers
Definition: SciDAVisObject.h:21
SciDAVisObject::m_setParent
void m_setParent(QWidget *child, QWidget *parent)
Definition: SciDAVisObject.h:12
SciDAVisObject::SciDAVisObject
SciDAVisObject(A... args)
Definition: SciDAVisObject.h:17