-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.cpp
81 lines (69 loc) · 2.21 KB
/
settings.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "settings.h"
#include "ui_settings.h"
#include <QColorDialog>
#include <QFontDialog>
#include "saveload.h"
#include <QDebug>
settings::settings(QWidget *parent) :
QDialog(parent),
ui(new Ui::settings)
{
ui->setupUi(this);
myNick=new QColor();
otherNick=new QColor();
font= new QFont();
saveLoad *load =new saveLoad(this);
load->load(myNick,otherNick,font);
ui->pb_myNick->setStyleSheet("QPushButton { background-color: rgb("+QString::number(myNick->red())+
","+QString::number(myNick->green())+","+QString::number(myNick->blue())+");}");
ui->pb_otherNick->setStyleSheet("QPushButton { background-color: rgb("+QString::number(otherNick->red())+
","+QString::number(otherNick->green())+","+QString::number(otherNick->blue())+");}");
delete load;
}
settings::~settings()
{
delete ui;
delete myNick;
delete font;
delete otherNick;
}
void settings::on_pb_myNick_clicked()
{
QColor color;
color= QColorDialog::getColor(*myNick,this);
if(color.isValid())
{
*myNick=color;
ui->pb_myNick->setStyleSheet("QPushButton { background-color: rgb("+QString::number(myNick->red())+
","+QString::number(myNick->green())+","+QString::number(myNick->blue())+");}");
}
}
void settings::on_pb_otherNick_clicked()
{
QColor color;
color= QColorDialog::getColor(*otherNick,this);
if(color.isValid())
{
*otherNick=color;
ui->pb_otherNick->setStyleSheet("QPushButton { background-color: rgb("+QString::number(otherNick->red())+
","+QString::number(otherNick->green())+","+QString::number(otherNick->blue())+");}");
}
}
void settings::on_pb_font_clicked()
{
bool ok;
*font = QFontDialog::getFont(&ok, *font,this,"Выберите шрифт");
if (ok) {
// text->setFont(font);
} else{
// the user canceled the dialog; font is set to the initial
// value, in this case Times, 12.
}
}
void settings::on_buttonBox_accepted()
{
qDebug()<<"Hажата ок";
saveLoad *save =new saveLoad(this);
save->save(myNick,otherNick,font);
delete save;
}