#include "DlgQrcodeFormat.h" #include "ui_DlgQrcodeFormat.h" DlgQrcodeFormat::DlgQrcodeFormat(QWidget *parent) : QDialog(parent), ui(new Ui::DlgQrcodeFormat) { ui->setupUi(this); setViewModel(m_vm); ui->comboBoxType->setEnabled(false); } DlgQrcodeFormat::~DlgQrcodeFormat() { delete ui; } void DlgQrcodeFormat::setViewModel(DlgQrcodeFormatVM vm) { m_vm = vm; ui->comboBoxType->setCurrentIndex(int(vm.type)); ui->comboBoxInkColor->setCurrentIndex(int(vm.inkType)); ui->comboBox_DMType->setCurrentIndex(int(vm.size)); ui->comboBox_QRCodeLevel->setCurrentIndex(int(vm.level)); } DlgQrcodeFormatVM DlgQrcodeFormat::viewModel() { m_vm.type = QRCodeType(ui->comboBoxType->currentIndex()); m_vm.inkType = InkType(ui->comboBoxInkColor->currentIndex()); m_vm.level = QRCodeLevel(ui->comboBox_QRCodeLevel->currentIndex()); m_vm.size = QRCodeSize(ui->comboBox_DMType->currentIndex()); return m_vm; } void DlgQrcodeFormat::setCodeType(QString type) { // type = "QRCode" "DataMatrix" ui->comboBoxType->setCurrentText(type); }