-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpushbuttonbit.cpp
executable file
·59 lines (44 loc) · 1.08 KB
/
pushbuttonbit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "pushbuttonbit.h"
PushButtonBit::PushButtonBit(QWidget *parent):QPushButton(parent)
{
this->bit = 1;
this->setStyleSheet(QString::fromUtf8("background-color: rgb(255, 0, 0);"));
connect(this, SIGNAL(clicked()), this, SLOT(slot_pushButtonBit_clicked()));
}
PushButtonBit::~PushButtonBit()
{
}
void PushButtonBit::slot_pushButtonBit_clicked()
{
// emit bitChanged();
if(this->bit == 1)
{
this->setText("0");
bit = 0;
this->setStyleSheet(QString::fromUtf8("background-color: rgb(170, 255, 0);"));
}
else
if(this->bit == 0)
{
this->setText("1");
bit = 1;
this->setStyleSheet(QString::fromUtf8("background-color: rgb(255, 0, 0);"));
}
emit clicked(this->numberBit);
}
bool PushButtonBit::getValueBit()
{
return this->bit;
}
void PushButtonBit::setValueBit( bool bit )
{
this->bit = bit;
}
int PushButtonBit::getNumberBit()
{
return this->numberBit;
}
void PushButtonBit::setNumberBit(int numberBit)
{
this->numberBit = numberBit;
}