-
Notifications
You must be signed in to change notification settings - Fork 2
/
ColorPanel.cpp
53 lines (44 loc) · 1.51 KB
/
ColorPanel.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
#include "ColorPanel.h"
#include <QInputDialog>
ColorPanel::ColorPanel(QWidget* parent):QWidget(parent)
{
Btn1 =new QPushButton;
Btn2 =new QPushButton;
Btn3 =new QPushButton;
Btn4 =new QPushButton;
Btn5 =new QPushButton;
Btn6 =new QPushButton;
Btn7 =new QPushButton;
Btn8 =new QPushButton;
Btn9 =new QPushButton;
Btn1->resize(10,10);
Btn2->resize(10,10);
Btn3->resize(10,10);
Btn4->resize(10,10);
Btn5->resize(10,10);
Btn6->resize(10,10);
Btn7->resize(10,10);
Btn8->resize(10,10);
Btn9->resize(10,10);
Btn1->setStyleSheet("QPushButton{background:black;}");
Btn2->setStyleSheet("QPushButton{background:white}");
Btn3->setStyleSheet("QPushButton{background:red}");
Btn4->setStyleSheet("QPushButton{background:blue}");
Btn5->setStyleSheet("QPushButton{background:gray}");
Btn6->setStyleSheet("QPushButton{background:green}");
Btn7->setStyleSheet("QPushButton{background:yellow}");
Btn8->setStyleSheet("QPushButton{background:orange}");
Btn9->setStyleSheet("QPushButton{background:blue}");
mainLayout =new QGridLayout(this);
mainLayout->addWidget(Btn1,0,0);
mainLayout->addWidget(Btn2,0,1);
mainLayout->addWidget(Btn3,0,2);
mainLayout->addWidget(Btn4,1,0);
mainLayout->addWidget(Btn5,1,1);
mainLayout->addWidget(Btn6,1,2);
mainLayout->addWidget(Btn7,2,0);
mainLayout->addWidget(Btn8,2,1);
mainLayout->addWidget(Btn9,2,2);
mainLayout->setMargin(10);
mainLayout->setSpacing(5);
}