-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialog.cpp
More file actions
120 lines (103 loc) · 2.85 KB
/
Copy pathdialog.cpp
File metadata and controls
120 lines (103 loc) · 2.85 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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include "dialog.h"
#include "ui_dialog.h"
#include <QScreen>
#include <QDebug>
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
changeOfSettings = false;
setX = 10;
setY = 10;
setWidth=30;
getScreenWidthHeight();
ui->setupUi(this);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::setstart(uint8_t y, uint8_t x, uint8_t width)
{
ui->spinBox->setValue(x);
ui->spinBox_2->setValue(y);
ui->spinBox_3->setValue(width);
setX = x;
setY = y;
setWidth = width;
}
void Dialog::on_pushButton_clicked()
{
changeOfSettings = true;
setX = ui->spinBox->value();
setY = ui->spinBox_2->value();
setWidth = ui->spinBox_3->value();
close();
}
uint8_t Dialog::getX()
{
return setX;
}
uint8_t Dialog::getY()
{
return setY;
}
uint8_t Dialog::getWidth()
{
return setWidth;
}
void Dialog::setLanguage(QString formTitle, QString groupText, QString labelCellInRow, QString labelCellInColumn, QString labelCellWidth, QString btnCancel, QString labelInfo, QString labelWindowSize)
{
ui->label->setText(labelCellInRow);
ui->label_2->setText(labelCellInColumn);
ui->label_3->setText(labelCellWidth);
ui->label_4->setText(labelInfo);
ui->label_5->setText(labelWindowSize);
ui->pushButton_2->setText(btnCancel);
setWindowTitle(formTitle);
ui->groupBox->setTitle(groupText);
}
void Dialog::on_pushButton_2_clicked()
{
close();
}
bool Dialog::isChangeOfSettings()
{
return changeOfSettings;
}
void Dialog::getScreenWidthHeight()
{
QScreen *screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
screenHeight = screenGeometry.height();
screenWidth = screenGeometry.width();
qDebug() << screenWidth << " " << screenHeight;
}
void Dialog::recalculateTheApplicationSize()
{
applicationSizeWidth = ui->spinBox->value() * ui->spinBox_3->value();
applicationSizeHeight = ui->spinBox_2->value() * ui->spinBox_3->value();
ui->label_6->setText(QString::number(applicationSizeWidth) + "/" + QString::number(applicationSizeHeight));
if (applicationSizeHeight > screenHeight || applicationSizeWidth > screenWidth)
{
ui->label_6->setStyleSheet("font-weight: bold; color: red");
ui->label_5->setStyleSheet("font-weight: bold; color: red");
}
else
{
ui->label_6->setStyleSheet("font-weight: normal; color: black");
ui->label_5->setStyleSheet("font-weight: normal; color: black");
}
}
void Dialog::on_spinBox_valueChanged(int arg1)
{
recalculateTheApplicationSize();
}
void Dialog::on_spinBox_2_valueChanged(int arg1)
{
recalculateTheApplicationSize();
}
void Dialog::on_spinBox_3_valueChanged(int arg1)
{
recalculateTheApplicationSize();
}