Added a QSortFilterProxyModel subclass to enable sorting by different columns in the views.

This commit is contained in:
2026-01-12 09:56:50 +01:00
parent 3597fcf0b0
commit a6512f2c67
5 changed files with 77 additions and 1 deletions

View File

@ -12,6 +12,7 @@
#include "CoreConfig.h"
#include "constants.h"
#include "data/filehandler.h"
#include "model/generalsortfiltermodel.h"
#include "model/metadata.h"
#include "model/tablemodel.h"
@ -89,6 +90,10 @@ QUndoStack* GenericCore::getModelUndoStack() const { return m_modelUndoStack; }
std::shared_ptr<TableModel> GenericCore::getModel() const { return m_mainModel; }
std::shared_ptr<GeneralSortFilterModel> GenericCore::getSortFilterModel() const {
return m_sortFilterModel;
}
/**
* Save items to default file (in standard location).
* @brief GenericCore::saveItems Saves item fo file.
@ -127,7 +132,9 @@ bool GenericCore::exportCSVFile(const QString& filePath) {
}
void GenericCore::setupModels() {
m_mainModel = make_shared<TableModel>(m_modelUndoStack, this);
m_mainModel = make_shared<TableModel>(m_modelUndoStack, this);
m_sortFilterModel = make_shared<GeneralSortFilterModel>(m_mainModel);
// TODO add QAbstractItemModelTester
initModelData();
}