ifw-fcfui 1.0.1
 
Loading...
Searching...
No Matches
qeled.hpp
Go to the documentation of this file.
1
7
8#ifndef QELED_H
9#define QELED_H
10
11#include <QWidget>
12//#include <QtSvg>
13#include <QtSvg/QSvgRenderer>
14#include <QColor>
15#include <QXmlStreamReader>
16#include <QFile>
17#include <QPainter>
18#include <QDebug>
19
20
21class QeLed : public QWidget
22{
23 Q_OBJECT
24
25 Q_PROPERTY(QColor colorOn READ getColorOn WRITE setColorOn NOTIFY colorOnChanged)
26 Q_PROPERTY(bool lit READ isLit WRITE setLit NOTIFY toggled)
27 Q_PROPERTY(bool negate READ isNegated WRITE setNegate NOTIFY negated)
28
29public:
30 explicit QeLed(QWidget *parent = nullptr);
31
32 QColor getColorOn() { return this->m_colorOn;}
33 bool isLit() { return this->m_lit;}
34 bool isNegated(){ return this->m_negate;}
35
36public slots:
37 void setColorOn(QColor arg){this->m_colorOn = arg; this->updateColor(); emit colorOnChanged(arg);}
38 void setLit(bool arg){ this->m_lit = arg; this->updateColor(); emit toggled(arg);}
39 void setNegate(bool arg){ this->m_negate = arg; this->updateColor(); emit negated(arg);}
40
41signals:
42 void colorOnChanged(QColor newColorOn);
43 void toggled(bool newValue);
44 void negated(bool newValue);
45
46protected:
47 void paintEvent(QPaintEvent *event) override;
48
49private:
50 bool m_lit = false;
51 bool m_negate = false;
52 QColor m_colorOn;
53 QSvgRenderer m_svg;
54 QString m_originalXml;
55 QString m_modifiedXml;
56 const QString c_ledImagePath = ":/led.svg";
57
58 void updateColor();
59 QColor calculateColor();
60};
61
62#endif // EULED_H
void negated(bool newValue)
void setColorOn(QColor arg)
Definition qeled.hpp:37
void toggled(bool newValue)
void setLit(bool arg)
Definition qeled.hpp:38
QColor colorOn
Definition qeled.hpp:25
void setNegate(bool arg)
Definition qeled.hpp:39
bool lit
Definition qeled.hpp:26
bool negate
Definition qeled.hpp:27
void paintEvent(QPaintEvent *event) override
Definition qeled.cpp:29
QColor getColorOn()
Definition qeled.hpp:32
QeLed(QWidget *parent=nullptr)
QeLed implementation file.
Definition qeled.cpp:14
void colorOnChanged(QColor newColorOn)
bool isLit()
Definition qeled.hpp:33
bool isNegated()
Definition qeled.hpp:34