-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargwindowmine.cpp
More file actions
45 lines (36 loc) · 799 Bytes
/
argwindowmine.cpp
File metadata and controls
45 lines (36 loc) · 799 Bytes
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
#include "argwindowmine.h"
#include "ui_argwindowmine.h"
cargWindow::cargWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::cargWindow)
{
ui->setupUi(this);
}
cargWindow::~cargWindow()
{
delete ui;
}
void cargWindow::show(std::function<bool (const QString&)> func, QString lable, bool tryToConvert)
{
m_callback = std::move(func);
ui->label->setText(lable);
ui->label->setAlignment(Qt::AlignHCenter);
ui->lineEdit->setText("0");
m_tryToConert = tryToConvert;
QDialog::show();
}
void cargWindow::on_pushButton_clicked()
{
QString lineTxt(ui->lineEdit->text());
bool ok(true);
if (m_tryToConert)
{
lineTxt.toLongLong(&ok);
}
if (!ok)
{
lineTxt = "0";
}
m_callback(lineTxt);
QDialog::hide();
}