MRU1/abnticket.cpp
2025-07-02 08:18:27 +03:00

80 lines
1.4 KiB
C++

#include "abnticket.h"
#include "ui_abnticket.h"
abnticket::abnticket(QWidget *parent, int ab) :
QDialog(parent),
ui(new Ui::abnticket)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
hide();
n_Ab = 0;
vvodnomera vv(parent);
vv.setAbMax(4);
vv.setAbMin(1);
vv.exec();
n_Ab = vv.result();
if (n_Ab<=0)
{
vv.close();
this->close();
}
else
{
fillUi(n_Ab);
ui->lineEdit->setText(QString::number(n_Ab));
((Widget*)parent)->changeOpenWidget(this);
}
}
abnticket::~abnticket()
{
delete ui;
}
void abnticket::fillUi(int n_ab) {
Widget *p = (Widget*)this->parentWidget();
if (p) {
const int abType = p->grObj[n_ab]->type;
if (abType == 12) {
ui->lineEdit_2->setText(QString::fromLocal8Bit("2A6"));
ui->lineEdit_3->setText(QString::fromLocal8Bit("ÁÌ \"Øèëêà\""));
} else
{
ui->lineEdit_2->setText(QString::fromLocal8Bit("9A331"));
ui->lineEdit_3->setText(QString::fromLocal8Bit("ÁÌ \"ÒÎÐ\""));
}
}
}
void abnticket::closeEvent(QCloseEvent *event)
{
((Widget*)parent())->clearOpenWidget();
event->accept();
}
void abnticket::on_pushButton_4_clicked()
{
close();
}
void abnticket::on_pushButton_3_clicked()
{
close();
}
void abnticket::on_pushButton_2_clicked()
{
// int n = ui->lineEdit->text().toInt();
}