24 #define QLED_H |
24 #define QLED_H |
25 |
25 |
26 #include <QColor> |
26 #include <QColor> |
27 #include "widgetwithbackground.h" |
27 #include "widgetwithbackground.h" |
28 |
28 |
29 /** |
29 /** |
30 * Klasa reprezentująca diodę w dowolnym kolorze jako dwustabilny element wskazujący |
30 * A class representing a diode of any color as a bistable indicating element |
31 */ |
31 */ |
32 class Led : public WidgetWithBackground |
32 class Led : public WidgetWithBackground |
33 { |
33 { |
34 Q_OBJECT |
34 Q_OBJECT |
35 Q_PROPERTY( bool checked READ isChecked WRITE setChecked) |
35 Q_PROPERTY( bool checked READ isChecked WRITE setChecked) |
36 Q_PROPERTY( QColor color READ color WRITE setColor) |
36 Q_PROPERTY( QColor color READ color WRITE setColor) |
39 public: |
39 public: |
40 |
40 |
41 Led(QWidget *parent = 0); |
41 Led(QWidget *parent = 0); |
42 virtual ~Led() {}; |
42 virtual ~Led() {}; |
43 |
43 |
44 /** Zdarzenie obsługujące malowanie kontrolki */ |
44 /* The event that handles the painting of the control */ |
45 void paintEvent(QPaintEvent * event); |
45 void paintEvent(QPaintEvent * event); |
46 |
46 |
47 bool isChecked () const ; |
47 bool isChecked () const ; |
48 |
48 |
49 |
49 |
50 QColor color() const; |
50 QColor color() const; |
51 void setColor(QColor); |
51 void setColor(QColor); |
52 |
52 |
53 public slots: |
53 public slots: |
54 |
|
55 void setChecked(bool); |
54 void setChecked(bool); |
56 |
55 |
57 signals: |
56 signals: |
58 |
|
59 void checkChanged(bool val); |
57 void checkChanged(bool val); |
60 |
58 |
61 protected: |
59 protected: |
62 |
60 /** Initializes the painter coordinate system */ |
63 /** Inicjuje układ współrzędnych paintera */ |
|
64 void initCoordinateSystem(QPainter & painter); |
61 void initCoordinateSystem(QPainter & painter); |
65 |
62 |
66 /** |
63 /** |
67 * Maluje tło kontrolki w tym przypadku pierwszy plan czyli odblask światła kontrolki |
64 * Paints the background of the control, in this case the foreground, i.e. a reflection of the control's light |
68 * @param painter Przestrzeń kontrolki |
65 * @param painter Control space |
69 */ |
66 */ |
70 void paintBackground(QPainter & painter); |
67 void paintBackground(QPainter & painter); |
71 |
68 |
72 protected: |
69 protected: |
73 |
|
74 bool m_checked; |
70 bool m_checked; |
75 QColor m_color; |
71 QColor m_color; |
76 |
|
77 }; |
72 }; |
78 |
73 |
79 #endif // QLED_H |
74 #endif // QLED_H |