Renamed widgets subproject into BeetRoundWidgets.
This commit is contained in:
67
UIs/BeetRoundWidgets/views/itemdetailmapper.h
Normal file
67
UIs/BeetRoundWidgets/views/itemdetailmapper.h
Normal file
@ -0,0 +1,67 @@
|
||||
#ifndef ITEMDETAILMAPPER_H
|
||||
#define ITEMDETAILMAPPER_H
|
||||
|
||||
#include <QDataWidgetMapper>
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QDoubleSpinBox;
|
||||
class QSpinBox;
|
||||
class QPushButton;
|
||||
class QAbstractItemModel;
|
||||
class QItemSelectionModel;
|
||||
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_nameLabel = nullptr;
|
||||
QLineEdit* m_nameEdit = nullptr;
|
||||
|
||||
QLabel* m_descriptionLabel = nullptr;
|
||||
QLineEdit* m_descriptionEdit = nullptr;
|
||||
|
||||
QLabel* m_infoLabel = nullptr;
|
||||
QLineEdit* m_infoEdit = nullptr;
|
||||
|
||||
QLabel* m_amountLabel = nullptr;
|
||||
QSpinBox* m_amountBox = nullptr;
|
||||
|
||||
QLabel* m_factorLabel = nullptr;
|
||||
QDoubleSpinBox* m_factorBox = nullptr;
|
||||
|
||||
QPushButton* m_nextButton;
|
||||
QPushButton* m_previousButton;
|
||||
};
|
||||
|
||||
#endif // ITEMDETAILMAPPER_H
|
||||
Reference in New Issue
Block a user