Add save and revert button to datagrid no implicit saves any more.
This commit is contained in:
parent
66267334c8
commit
ee1a8ba48d
9 changed files with 153 additions and 12 deletions
|
|
@ -4,8 +4,10 @@
|
|||
#include <QWidget>
|
||||
|
||||
class QAbstractItemModel;
|
||||
class QAction;
|
||||
class QSortFilterProxyModel;
|
||||
class QTableView;
|
||||
class QToolBar;
|
||||
|
||||
/** Sortable and editable grid shared by the CRUD tab and the query result tab.
|
||||
*/
|
||||
|
|
@ -20,9 +22,21 @@ public:
|
|||
QTableView *view() const { return m_view; }
|
||||
QSortFilterProxyModel *proxy() const { return m_proxy; }
|
||||
|
||||
private slots:
|
||||
void onPendingChangesChanged(bool hasChanges);
|
||||
void onSave();
|
||||
void onRevert();
|
||||
|
||||
private:
|
||||
/// Closes an open cell editor so its value is written to the model before saving or reverting
|
||||
void commitOpenEditor();
|
||||
|
||||
QTableView *m_view = nullptr;
|
||||
QSortFilterProxyModel *m_proxy = nullptr;
|
||||
QToolBar *m_toolbar = nullptr;
|
||||
QAction *m_actSave = nullptr;
|
||||
QAction *m_actRevert = nullptr;
|
||||
QMetaObject::Connection m_pendingChangesConnection;
|
||||
};
|
||||
|
||||
#endif // DATAGRIDWIDGET_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue