-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWelcomeWindow.cpp
More file actions
58 lines (44 loc) · 1.29 KB
/
Copy pathWelcomeWindow.cpp
File metadata and controls
58 lines (44 loc) · 1.29 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
#include "WelcomeWindow.h"
#include <string>
#include <QIntValidator>
#include <QMessageBox>
WelcomeWindow::WelcomeWindow(QWidget *parent)
: QWidget(parent)
, ui(new Ui::WelcomeWindow)
{
ui->setupUi(this);
QIntValidator *intValidator = new QIntValidator(0, 200, this);
ui->UserX->setValidator(intValidator);
ui->UserY->setValidator(intValidator);
// connect(ui->submitcordsbtn, &QPushButton::clicked, this, &WelcomeWindow::on_submitcordsbtn_clicked);
}
WelcomeWindow::~WelcomeWindow()
{
delete ui;
}
int userX;
int userY;
void WelcomeWindow::on_UserX_textChanged(const QString &arg1)
{
userX = arg1.toInt();
std::cout<<userX<<std::endl;
if (userX < 0 || userX > 200) {
ui->UserX->clear();
QMessageBox::warning(this, "Input Error", "Please enter a number between 0 and 200.");
return;
}
}
void WelcomeWindow::on_UserY_textChanged(const QString &arg1)
{
userY = arg1.toInt();
std::cout<<userY<<std::endl;
if (userY < 0 || userY > 200) {
ui->UserY->clear();
QMessageBox::warning(this, "Input Error", "Please enter a number between 0 and 200.");
return;
}
}
void WelcomeWindow::on_submitcordsbtn_clicked()
{
emit switchToResultsPage(userX, userY); // Emit the signal to switch to ResultsPage
}