Added an AbstractDialog class and using it as base for a NewItemDialog class (no new item functionality yet).
This commit is contained in:
60
Dialogs/newitemdialog.cpp
Normal file
60
Dialogs/newitemdialog.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
#include "newitemdialog.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include <model/tablemodel.h>
|
||||
|
||||
NewItemDialog::NewItemDialog(QWidget* parent)
|
||||
: AbstractDialog(parent) {}
|
||||
|
||||
void NewItemDialog::createContent() {
|
||||
if (m_contentContainer) {
|
||||
delete m_contentContainer;
|
||||
}
|
||||
|
||||
setWindowTitle(tr("New item..."));
|
||||
|
||||
m_contentContainer = new QWidget(this);
|
||||
|
||||
// REFACTOR deduce label names and types from meta data & use a factory
|
||||
m_nameLabel = new QLabel("&Name");
|
||||
m_nameEdit = new QLineEdit();
|
||||
m_nameLabel->setBuddy(m_nameEdit);
|
||||
|
||||
m_descriptionLabel = new QLabel("&Description");
|
||||
m_descriptionEdit = new QLineEdit();
|
||||
m_descriptionLabel->setBuddy(m_descriptionEdit);
|
||||
|
||||
m_infoLabel = new QLabel("&Info");
|
||||
m_infoEdit = new QLineEdit();
|
||||
m_infoLabel->setBuddy(m_infoEdit);
|
||||
|
||||
m_amountLabel = new QLabel("&Amount");
|
||||
m_amountBox = new QSpinBox();
|
||||
m_amountBox->setMaximum(1000);
|
||||
m_amountLabel->setBuddy(m_amountBox);
|
||||
|
||||
m_factorLabel = new QLabel("&Factor");
|
||||
m_factorBox = new QSpinBox();
|
||||
m_factorBox->setMaximum(1000);
|
||||
m_factorLabel->setBuddy(m_factorBox);
|
||||
|
||||
QGridLayout* layout = new QGridLayout();
|
||||
layout->addWidget(m_nameLabel, 0, 0, 1, 1);
|
||||
layout->addWidget(m_nameEdit, 0, 1, 1, 1);
|
||||
layout->addWidget(m_descriptionLabel, 1, 0, 1, 1);
|
||||
layout->addWidget(m_descriptionEdit, 1, 1, 1, 1);
|
||||
layout->addWidget(m_infoLabel, 2, 0, 1, 1);
|
||||
layout->addWidget(m_infoEdit, 2, 1, 1, 1);
|
||||
layout->addWidget(m_amountLabel, 3, 0, 1, 1);
|
||||
layout->addWidget(m_amountBox, 3, 1, 1, 1);
|
||||
layout->addWidget(m_factorLabel, 4, 0, 1, 1);
|
||||
layout->addWidget(m_factorBox, 4, 1, 1, 1);
|
||||
|
||||
m_contentContainer->setLayout(layout);
|
||||
|
||||
m_outerLayout->insertWidget(0, m_contentContainer);
|
||||
}
|
||||
Reference in New Issue
Block a user