Using the new QSortFilterProxyModel subclass of the core for the TableView.
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include "dialogs/edititemdialog.h"
|
||||
#include "dialogs/newitemdialog.h"
|
||||
#include "genericcore.h"
|
||||
#include "model/generalsortfiltermodel.h"
|
||||
#include "model/tablemodel.h"
|
||||
|
||||
static QStandardPaths::StandardLocation standardLocation = QStandardPaths::HomeLocation;
|
||||
@ -45,7 +46,10 @@ MainWindow::MainWindow(QWidget* parent)
|
||||
restoreState(settings.value("windowState").toByteArray());
|
||||
|
||||
m_tableModel = m_core->getModel();
|
||||
ui->tableView->setModel(m_tableModel.get());
|
||||
// ui->tableView->setModel(m_tableModel.get());
|
||||
m_sortModel = m_core->getSortFilterModel();
|
||||
ui->tableView->setModel((QAbstractItemModel*)m_sortModel.get());
|
||||
ui->tableView->setSortingEnabled(true);
|
||||
|
||||
createActions();
|
||||
createHelpMenu();
|
||||
|
||||
@ -16,6 +16,7 @@ QT_END_NAMESPACE
|
||||
|
||||
class GenericCore;
|
||||
class TableModel;
|
||||
class GeneralSortFilterModel;
|
||||
class NewItemDialog;
|
||||
class EditItemDialog;
|
||||
|
||||
@ -65,6 +66,7 @@ class MainWindow : public QMainWindow {
|
||||
// GenericCore* m_core;
|
||||
unique_ptr<GenericCore> m_core;
|
||||
shared_ptr<TableModel> m_tableModel;
|
||||
shared_ptr<GeneralSortFilterModel> m_sortModel;
|
||||
QUndoStack* m_modelUndoStack;
|
||||
unique_ptr<QUndoView> m_modelUndoView;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user