QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qvswitch.h
1 /* QVisu (c) 2015 Maximilian Gauger mgauger@kalassi.de
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12 
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef QVSWITCH_H
18 #define QVSWITCH_H
19 
20 #include <QByteArray>
21 #include <QLabel>
22 #include "../qvsvgwidget.h"
23 #include "../qviconwidget.h"
24 #include "../qvswitchicon.h"
25 #include <QGridLayout>
26 #include "../qvelement.h"
27 
28 class QVSwitch : public QVElement
29 {
30  Q_OBJECT
31 public:
32  explicit QVSwitch(QDomElement xml_desc, QString container, bool readonly = false, QWidget *parent = 0);
33 
34 protected:
35  void resizeEvent(QResizeEvent *);
36  void mousePressEvent(QMouseEvent *);
37 
38 signals:
39 
40 public slots:
41  void onValueChanged(QString,QString);
42 
43 private slots:
44  void svgPressed();
45 
46 private:
47  QByteArray svg_icon;
48  QByteArray svg_sw_icon, svg_sw_icon_on;
49  QVIconWidget *w_icon;
50  QVSwitchIcon *w_sw_icon;
51  QLabel *w_text;
52 
53  bool value;
54  bool readonly;
55 };
56 
57 #endif // QVSWITCH_H
Definition: qvswitchicon.h:24
Definition: qviconwidget.h:26
void resizeEvent(QResizeEvent *)
Definition: qvswitch.cpp:60
Definition: qvelement.h:34
Definition: qvswitch.h:28
QString container
Definition: qvelement.h:73