Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DockWidget.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OMNI_UI_DOCKWIDGET_H_
20 #define OMNI_UI_DOCKWIDGET_H_
21 
22 #include <QScrollArea>
23 
24 namespace omni {
25  namespace ui {
26  /// DockWidget is scroll area with an embedded widget
27  class DockWidget : public QScrollArea {
28  Q_OBJECT
29 
30  public:
31  DockWidget(QWidget * = nullptr);
32 
33  template<typename UI>
34  DockWidget(UI& _ui, QWidget *_parent = nullptr) :
35  QScrollArea(_parent) {}
36 
37  virtual ~DockWidget() {}
38 
39  protected:
40  /**@brief Setup ui form
41  @detail UI parameter is smart pointer (e.g. unique_ptr) to UI form
42  **/
43  template<typename UI>
44  void setup(UI& _ui) {
45  _ui.reset(new typename UI::element_type);
46  auto *_widget = new QWidget(this);
47  this->setWidget(_widget);
48  this->setWidgetResizable(true);
49  _ui->setupUi(this->widget());
50  }
51  };
52  }
53 }
54 
55 #endif /* OMNI_UI_DOCKWIDGET_H_ */
virtual ~DockWidget()
Definition: DockWidget.h:37
void setup(UI &_ui)
Setup ui form UI parameter is smart pointer (e.g. unique_ptr) to UI form.
Definition: DockWidget.h:44
DockWidget(QWidget *=nullptr)
Definition: DockWidget.cpp:24
DockWidget(UI &_ui, QWidget *_parent=nullptr)
Definition: DockWidget.h:34
DockWidget is scroll area with an embedded widget.
Definition: DockWidget.h:27