Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Widget.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 
20 #ifndef OMNI_UI_WIDGET_H_
21 #define OMNI_UI_WIDGET_H_
22 
23 #include <QWidget>
24 #include <QLabel>
25 #include <QPalette>
26 #include <omni/ui/ColorSet.h>
27 
28 namespace omni {
29  namespace ui {
30  /// A single parameter widget with a label and color set
31  class Widget : public QWidget {
32  Q_OBJECT
33 
34  public:
35  Widget(QWidget * = nullptr);
36  Widget(QString const& _label,
37  QWidget * = nullptr);
38  virtual ~Widget() {}
39 
40  /// Return label text of widget
41  QString label() const;
42 
43  /// Set label text of widget
44  void setLabel(QString const&);
45 
46  ColorSet const& colorSet() const;
47 
48  /// Zoom factor of widget
49  double zoomFactor() const;
50 
51  protected:
52  void drawBorder(QPainter&);
53  void drawBorder(QPainter&,
54  bool _focus);
55  QLabel *label_;
56 
57  private:
58  void init();
59 
61  double zoomFactor_ = 1.0;
62  };
63  }
64 }
65 
66 #endif /* OMNI_UI_WIDGET_H_ */
Simplies color access from a palette for a widget.
Definition: ColorSet.h:29
QLabel * label_
Definition: Widget.h:55
void drawBorder(QPainter &)
Definition: Widget.cpp:79
ColorSet colorSet_
Definition: Widget.h:60
A single parameter widget with a label and color set.
Definition: Widget.h:31
double zoomFactor() const
Zoom factor of widget.
QString label() const
Return label text of widget.
Definition: Widget.cpp:45
virtual ~Widget()
Definition: Widget.h:38
void setLabel(QString const &)
Set label text of widget.
Definition: Widget.cpp:50
ColorSet const & colorSet() const
Definition: Widget.cpp:56
void init()
Definition: Widget.cpp:61
double zoomFactor_
Definition: Widget.h:61
Widget(QWidget *=nullptr)
Definition: Widget.cpp:30