Files
BeetRound/UIs/BeetRoundWidgets/views/itemdetailmapper.h

91 lines
2.1 KiB
C++

#ifndef ITEMDETAILMAPPER_H
#define ITEMDETAILMAPPER_H
#include <QDataWidgetMapper>
#include <QWidget>
class QLabel;
class QLineEdit;
class QComboBox;
class QDoubleSpinBox;
class QSpinBox;
class QPushButton;
class QAbstractItemModel;
class QItemSelectionModel;
class QStringListModel;
class QTableView;
class ItemDetailMapper : public QWidget {
Q_OBJECT
public:
explicit ItemDetailMapper(QWidget* parent = nullptr);
void setModelMappings(QTableView* tableView);
bool submit();
void revert();
signals:
void contentChanged(const QString text);
private slots:
void onCurrentIndexChanged(const QModelIndex& current, const QModelIndex& previous);
void rowsInserted(const QModelIndex& parent, int start, int end);
void rowsRemoved(const QModelIndex& parent, int start, int end);
void toPrevious();
void toNext();
void updateButtons(int row);
void emitContentChanged(const QModelIndex& currentIndex);
private:
/// *** members ***
/// Model stuff
QTableView* m_tableView = nullptr;
QAbstractItemModel* m_model = nullptr;
QItemSelectionModel* m_selectionModel = nullptr;
std::unique_ptr<QDataWidgetMapper> m_mapper;
/// GUI elements
QLabel* m_numberLabel;
QSpinBox* m_numberBox;
QLabel* m_lastNameLabel;
QLineEdit* m_lastNameEdit;
QLabel* m_firstNameLabel;
QLineEdit* m_firstNameEdit;
QLabel* m_shareTypeLabel;
QComboBox* m_shareTypeBox;
QStringListModel* m_shareTypeModel = nullptr;
QLabel* m_amountLabel;
QDoubleSpinBox* m_amountSpinBox;
QLabel* m_biddingTypeLabel;
QComboBox* m_biddingTypeBox;
QStringListModel* m_biddingTypeModel = nullptr;
QLabel* m_bidding1Label;
QSpinBox* m_bidding1SpinBox;
QLabel* m_bidding2Label;
QSpinBox* m_bidding2SpinBox;
QLabel* m_bidding3Label;
QSpinBox* m_bidding3SpinBox;
QLabel* m_depotWish1Label;
QLineEdit* m_depotWish1Edit;
QLabel* m_depotWish2Label;
QLineEdit* m_depotWish2Edit;
QLabel* m_mailLabel;
QLineEdit* m_mailEdit;
/// Model mapper stuff
QPushButton* m_nextButton;
QPushButton* m_previousButton;
};
#endif // ITEMDETAILMAPPER_H