53 #include "ui_dialognewmeasurements.h"
55 #include "../vpatterndb/variables/vmeasurement.h"
56 #include "../vmisc/vseamlymesettings.h"
57 #include "../mapplication.h"
77 int index =
ui->comboBoxBaseHeight->findText(QString().setNum(height));
80 ui->comboBoxBaseHeight->setCurrentIndex(index);
84 index =
ui->comboBoxBaseSize->findText(QString().setNum(size));
87 ui->comboBoxBaseSize->setCurrentIndex(index);
90 connect(
ui->comboBoxMType,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
this,
93 connect(
ui->comboBoxUnit,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
this,
112 return static_cast<Unit>(
ui->comboBoxUnit->currentData().toInt());
118 return ui->comboBoxBaseSize->currentText().toInt();
124 return ui->comboBoxBaseHeight->currentText().toInt();
130 if (event->type() == QEvent::LanguageChange)
133 ui->retranslateUi(
this);
139 QDialog::changeEvent(event);
145 QDialog::showEvent( event );
146 if ( event->spontaneous() )
157 setMaximumSize(size());
158 setMinimumSize(size());
169 ui->comboBoxBaseSize->setEnabled(
true);
170 ui->comboBoxBaseHeight->setEnabled(
true);
174 ui->comboBoxBaseSize->setEnabled(
false);
175 ui->comboBoxBaseHeight->setEnabled(
false);
187 int i =
ui->comboBoxBaseHeight->currentIndex();
189 ui->comboBoxBaseHeight->setCurrentIndex(i);
191 i =
ui->comboBoxBaseSize->currentIndex();
193 ui->comboBoxBaseSize->setCurrentIndex(i);
201 if (
ui->comboBoxMType->currentIndex() != -1)
203 val =
ui->comboBoxMType->currentData().toInt();
206 ui->comboBoxMType->blockSignals(
true);
207 ui->comboBoxMType->clear();
210 ui->comboBoxMType->blockSignals(
false);
212 int index =
ui->comboBoxMType->findData(val);
215 ui->comboBoxMType->setCurrentIndex(index);
223 ui->comboBoxBaseHeight->clear();
224 ui->comboBoxBaseHeight->addItems(list);
231 ui->comboBoxBaseSize->clear();
232 ui->comboBoxBaseSize->addItems(list);
238 int val =
static_cast<int>(
Unit::Cm);
239 if (
ui->comboBoxUnit->currentIndex() != -1)
241 val =
ui->comboBoxUnit->currentData().toInt();
244 ui->comboBoxUnit->blockSignals(
true);
245 ui->comboBoxUnit->clear();
246 ui->comboBoxUnit->addItem(tr(
"Centimeters"),
static_cast<int>(
Unit::Cm));
247 ui->comboBoxUnit->addItem(tr(
"Millimeters"),
static_cast<int>(
Unit::Mm));
250 ui->comboBoxUnit->addItem(tr(
"Inches"),
static_cast<int>(
Unit::Inch));
252 ui->comboBoxUnit->setCurrentIndex(-1);
253 ui->comboBoxUnit->blockSignals(
false);
255 int index =
ui->comboBoxUnit->findData(val);
258 ui->comboBoxUnit->setCurrentIndex(index);
262 index =
ui->comboBoxUnit->findData(
static_cast<int>(
Unit::Cm));
263 ui->comboBoxUnit->setCurrentIndex(index);
Ui::DialogNewMeasurements * ui
void CurrentUnitChanged(int index)
MeasurementsType Type() const
void CurrentTypeChanged(int index)
virtual void changeEvent(QEvent *event) Q_DECL_OVERRIDE
DialogNewMeasurements(QWidget *parent=nullptr)
void InitUnits(const MeasurementsType &type)
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE
static QStringList WholeListSizes(Unit patternUnit)
static QStringList WholeListHeights(Unit patternUnit)
qreal UnitConvertor(qreal value, const Unit &from, const Unit &to)