53 #include "ui_dialognewpattern.h"
54 #include "../core/vapplication.h"
55 #include "../vmisc/vsettings.h"
56 #include "../vpatterndb/vcontainer.h"
58 #include <QFileDialog>
59 #include <QMessageBox>
60 #include <QPushButton>
62 #include <QGuiApplication>
71 ui->lineEditName->setClearButtonEnabled(
true);
73 qApp->Seamly2DSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
75 QRect position = this->frameGeometry();
76 position.moveCenter(QGuiApplication::primaryScreen()->availableGeometry().center());
77 move(position.topLeft());
79 ui->lineEditName->setText(patternPieceName);
95 const qint32 index =
ui->comboBoxUnits->currentIndex();
96 return StrToUnits(
ui->comboBoxUnits->itemData(index).toString());
102 bool flagName =
false;
103 if (
ui->lineEditName->text().isEmpty() ==
false)
108 QPushButton *ok_Button =
ui->buttonBox->button(QDialogButtonBox::Ok);
110 ok_Button->setEnabled(flagName);
116 QDialog::showEvent( event );
117 if ( event->spontaneous() )
128 setMaximumSize(size());
129 setMinimumSize(size());
142 const qint32 indexUnit =
ui->comboBoxUnits->findData(
qApp->Seamly2DSettings()->GetUnit());
145 ui->comboBoxUnits->setCurrentIndex(indexUnit);
152 return ui->lineEditName->text();
Ui::DialogNewPattern * ui
DialogNewPattern(VContainer *data, const QString &patternPieceName, QWidget *parent=nullptr)
virtual ~DialogNewPattern()
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE
The VContainer class container of all variables.
Unit StrToUnits(const QString &unit)
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.