Minor refactoring of ItemDetailMapper.
This commit is contained in:
@ -10,7 +10,6 @@
|
||||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
#include <QTableView>
|
||||
#include "model/metadata.h"
|
||||
|
||||
ItemDetailMapper::ItemDetailMapper(QTableView* tableView, QWidget* parent)
|
||||
: QWidget{parent} {
|
||||
@ -32,7 +31,6 @@ ItemDetailMapper::ItemDetailMapper(QTableView* tableView, QWidget* parent)
|
||||
|
||||
m_mapper->setModel(m_model);
|
||||
|
||||
setupNavigationButtons();
|
||||
setupWidgets();
|
||||
|
||||
setupConnections();
|
||||
@ -111,6 +109,10 @@ void ItemDetailMapper::setupNavigationButtons() {
|
||||
|
||||
connect(m_previousButton, &QAbstractButton::clicked, this, &ItemDetailMapper::toPrevious);
|
||||
connect(m_nextButton, &QAbstractButton::clicked, this, &ItemDetailMapper::toNext);
|
||||
|
||||
const int nRows = m_layout->rowCount();
|
||||
m_layout->addWidget(m_previousButton, nRows, 0);
|
||||
m_layout->addWidget(m_nextButton, nRows, 1);
|
||||
}
|
||||
|
||||
void ItemDetailMapper::setupWidgets() {
|
||||
@ -119,10 +121,7 @@ void ItemDetailMapper::setupWidgets() {
|
||||
for (int i = 0; i < USER_FACING_ROLES.size(); ++i) {
|
||||
setupWidgetPairForColumn(i);
|
||||
}
|
||||
|
||||
const int nRows = m_layout->rowCount();
|
||||
m_layout->addWidget(m_previousButton, nRows, 0);
|
||||
m_layout->addWidget(m_nextButton, nRows, 1);
|
||||
setupNavigationButtons();
|
||||
|
||||
setLayout(m_layout);
|
||||
}
|
||||
@ -147,7 +146,7 @@ void ItemDetailMapper::setupWidgetPairForColumn(const int column) {
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* ItemDetailMapper::createControlWidget(const int role) {
|
||||
QWidget* ItemDetailMapper::createControlWidget(const UserRoles role) {
|
||||
QWidget* control;
|
||||
if (STRING_ROLES.contains(role)) {
|
||||
control = new QLineEdit();
|
||||
@ -169,7 +168,7 @@ QWidget* ItemDetailMapper::createControlWidget(const int role) {
|
||||
return control;
|
||||
}
|
||||
|
||||
QWidget* ItemDetailMapper::createComboBox(const int role) {
|
||||
QWidget* ItemDetailMapper::createComboBox(const UserRoles role) {
|
||||
QStringListModel* typeModel;
|
||||
if (role == TypeRole) {
|
||||
typeModel = new QStringListModel(TYPES, this);
|
||||
|
||||
Reference in New Issue
Block a user