#include "dlgvarlength.h" #include "ui_dlgvarlength.h" DlgVarLength::DlgVarLength(QWidget *parent) : QDialog(parent), ui(new Ui::DlgVarLength) { ui->setupUi(this); connect(ui->pushButtonOK,SIGNAL(pressed()),this,SLOT(pushButtonOK_Pressed())); } DlgVarLength::~DlgVarLength() { delete ui; } void DlgVarLength::applyUI(int len) { int tmp=len/2; ui->spinHeadLen->setMaximum( tmp); ui->spinEndLen->setMaximum( tmp); ui->spinHeadLen->setValue(headLen); ui->spinEndLen->setValue(endLen); ui->spinVarLen->setValue(varLen); ui->spinVarLen1->setValue(varLen1); ui->checkVarEN->setChecked(varEn); ui->pushButtonOK->setFocus(); //ui->lab_AllLength ->setText(QString().sprintf("%0.1f",len)); ui->lineEditAllLen ->setText(QString().sprintf("%d",len)); } void DlgVarLength::pushButtonOK_Pressed() { headLen = ui->spinHeadLen->value(); endLen = ui->spinEndLen->value(); varLen = ui->spinVarLen->value(); varLen1 = ui->spinVarLen1->value(); varEn = ui->checkVarEN->isChecked(); emit on_set(); this->hide(); }