src/analog/led.h

changeset 316
dcd472be9ae8
child 319
d1861707054c
equal deleted inserted replaced
315:cf4e83cecdb5 316:dcd472be9ae8
1 /***************************************************************************
2 * Copyright (C) 2006-2008 by Tomasz Ziobrowski *
3 * http://www.3electrons.com *
4 * e-mail: t.ziobrowski@3electrons.com *
5 * *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (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 General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
22
23 #ifndef QLED_H
24 #define QLED_H
25
26 #include <QColor>
27 #include "widgetwithbackground.h"
28
29 /**
30 * Klasa reprezentująca diodę w dowolnym kolorze jako dwustabilny element wskazujący
31 */
32 class Led : public WidgetWithBackground
33 {
34 Q_OBJECT
35 Q_PROPERTY( bool checked READ isChecked WRITE setChecked)
36 Q_PROPERTY( QColor color READ color WRITE setColor)
37
38
39 public:
40
41 Led(QWidget *parent = 0);
42 virtual ~Led() {};
43
44 /** Zdarzenie obsługujące malowanie kontrolki */
45 void paintEvent(QPaintEvent * event);
46
47 bool isChecked () const ;
48
49
50 QColor color() const;
51 void setColor(QColor);
52
53 public slots:
54
55 void setChecked(bool);
56
57 signals:
58
59 void checkChanged(bool val);
60
61 protected:
62
63 /** Inicjuje układ współrzędnych paintera */
64 void initCoordinateSystem(QPainter & painter);
65
66 /**
67 * Maluje tło kontrolki w tym przypadku pierwszy plan czyli odblask światła kontrolki
68 * @param painter Przestrzeń kontrolki
69 */
70 void paintBackground(QPainter & painter);
71
72 protected:
73
74 bool m_checked;
75 QColor m_color;
76
77 };
78
79 #endif // QLED_H

mercurial