qt/LedOK/wProgramManager/wnewprogram.cpp

43 lines
1.3 KiB
C++
Raw Normal View History

2022-01-04 18:11:48 +08:00
#include "wnewprogram.h"
#include "ui_wnewprogram.h"
wNewProgram::wNewProgram(QWidget *parent) :
2022-08-25 18:37:24 +08:00
BaseDlg(parent),
2022-01-04 18:11:48 +08:00
ui(new Ui::wNewProgram)
{
2022-08-25 18:37:24 +08:00
setAttribute(Qt::WA_DeleteOnClose);
2022-01-04 18:11:48 +08:00
ui->setupUi(this);
//ui->pName->setText(tr("New") + QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"));
ui->pName->setText(QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"));
ui->pWidth->setValue(512);
ui->pHeight->setValue(512);
ui->pRemarks->setText("");
connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));
}
wNewProgram::wNewProgram(QString name, QSize res, QString remarks, QWidget *parent, bool lockName) :
2022-08-25 18:37:24 +08:00
BaseDlg(parent),
2022-01-04 18:11:48 +08:00
ui(new Ui::wNewProgram)
{
2022-08-25 18:37:24 +08:00
setAttribute(Qt::WA_DeleteOnClose);
2022-01-04 18:11:48 +08:00
ui->setupUi(this);
ui->pName->setText(name);
ui->pName->setDisabled(lockName);
ui->pWidth->setValue(res.width());
ui->pHeight->setValue(res.height());
ui->pRemarks->setText(remarks);
connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));
}
wNewProgram::~wNewProgram()
{
delete ui;
}
void wNewProgram::onAccepted()
{
emit sigAcceptData(ui->pName->text(),
QSize(ui->pWidth->value(), ui->pHeight->value()),
ui->pRemarks->document()->toPlainText());
}