QueryTool now uses the same DataGrid as the CRUD tool.

This commit is contained in:
eelke 2026-10-18 10:29:24 +02:00
parent bbe52c9db8
commit 5e7fb68c55
15 changed files with 135 additions and 203 deletions

View file

@ -0,0 +1,28 @@
#ifndef DATAGRIDWIDGET_H
#define DATAGRIDWIDGET_H
#include <QWidget>
class QAbstractItemModel;
class QSortFilterProxyModel;
class QTableView;
/** Sortable and editable grid shared by the CRUD tab and the query result tab.
*/
class DataGridWidget : public QWidget {
Q_OBJECT
public:
explicit DataGridWidget(QWidget *parent = nullptr);
/// Sets the model to show, sorting is done by a proxy that uses CustomSortRole
void setSourceModel(QAbstractItemModel *model);
QTableView *view() const { return m_view; }
QSortFilterProxyModel *proxy() const { return m_proxy; }
private:
QTableView *m_view = nullptr;
QSortFilterProxyModel *m_proxy = nullptr;
};
#endif // DATAGRIDWIDGET_H