QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
C:/Users/max/ti/qt5/qvisu/qviconwidget.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 QVICONWIDGET_H
18 #define QVICONWIDGET_H
19 
20 #include <QSvgWidget>
21 #include <QLabel>
22 #include <QByteArray>
23 #include <QtXml>
24 #include "qvsvgwidget.h"
25 
26 class QVIconWidget : public QFrame
27 {
28  Q_OBJECT
29 public:
30  explicit QVIconWidget(QWidget *parent = 0);
31  explicit QVIconWidget(QString file, QWidget *parent = 0);
32 
33  QSize defaultSize() const;
34  float aspectRatio() const;
35 
36  void resizeEvent(QResizeEvent*);
37  void mousePressEvent(QMouseEvent*);
38 
39 signals:
40  void clicked(double xrel, double yrel);
41  void dragged(double xrel, double yrel);
42  void released(double xrel, double yrel);
43 
44 public slots:
45  void load(const QByteArray&);
46  void setPathStyle(QString property, QString value, QString id = "", bool force_insert = false);
47  void preserveAspectRatio(bool);
48 
49 private slots:
50  void onSvgClicked(double,double);
51  void onSvgDragged(double,double);
52  void onSvgReleased(double,double);
53 
54 private:
55  QVSvgWidget *svg_widget;
56  QLabel *pix_widget;
57  QPixmap *pixmap;
58 
59  bool preserve_aspect_ratio;
60 };
61 
62 #endif // QVICONWIDGET_H
Definition: qviconwidget.h:26
Definition: qvsvgwidget.h:24