desktop: make divecomputer table sortable

Add a small proxy-model on top of DiveComputerModel so that clicking
on table headers makes the table sortable.

The UI feature here is not as important as the fact that the UI does
its own sorting and we can keep the device-table in the core sorted
differently.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-10-10 12:40:27 +02:00 committed by Dirk Hohndel
parent 5931be4c88
commit 215e5a4544
4 changed files with 50 additions and 3 deletions

View file

@ -1,9 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
#ifndef DIVECOMPUTERMANAGEMENTDIALOG_H
#define DIVECOMPUTERMANAGEMENTDIALOG_H
#include <QDialog>
#include "ui_divecomputermanagementdialog.h"
#include "qt-models/divecomputermodel.h"
#include <QDialog>
#include <memory>
class QModelIndex;
@ -23,7 +25,8 @@ slots:
private:
explicit DiveComputerManagementDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
Ui::DiveComputerManagementDialog ui;
QScopedPointer<DiveComputerModel> model;
std::unique_ptr<DiveComputerModel> model;
DiveComputerSortedModel proxyModel;
};
#endif // DIVECOMPUTERMANAGEMENTDIALOG_H