-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.cpp
More file actions
49 lines (40 loc) · 1.3 KB
/
settings.cpp
File metadata and controls
49 lines (40 loc) · 1.3 KB
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
#include "settings.h"
#include "ui_settings.h"
#include <QColorDialog>
Settings::Settings(QWidget *parent):
QDialog(parent),
ui(new Ui::Settings)
{
ui->setupUi(this);
setAttribute(Qt::WA_AlwaysStackOnTop, true);
setAutoFillBackground(true);
ui->spinBox->setValue(9);
}
Settings::~Settings()
{
delete ui;
}
void Settings::initialSetting(QColor c, QString fontFamily, int size)
{
ui->pb_changeColor->setStyleSheet(QString("* {background-color:rgba(%1,%2,%3,%4);}").arg(c.red()).arg(
c.green()).arg(c.blue()).arg(c.alpha()));
QFont f;
f.setFamily(fontFamily);
ui->fontComboBox->setCurrentFont(f);
ui->spinBox->setValue(size);
}
void Settings::on_pb_changeColor_clicked()
{
color = QColorDialog::getColor(Qt::black, this);
ui->pb_changeColor->setStyleSheet(QString("* {background-color:rgba(%1,%2,%3,%4);}").arg(color.red()).arg(
color.green()).arg(color.blue()).arg(color.alpha()));
emit changingTextColor(color);
}
void Settings::on_spinBox_valueChanged(int arg1)
{
emit changingFontSize(arg1);
}
void Settings::on_fontComboBox_currentFontChanged(const QFont &f)
{
emit changingTextFont(f);
}