1 | /* |
2 | SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net> |
3 | SPDX-FileContributor: Stephen Kelly <stephen@kdab.com> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef KVIEWSTATEMAINTAINERBASE_H |
9 | #define KVIEWSTATEMAINTAINERBASE_H |
10 | |
11 | #include "kwidgetsaddons_export.h" |
12 | |
13 | #include <QObject> |
14 | |
15 | #include <memory> |
16 | |
17 | class QItemSelectionModel; |
18 | class QAbstractItemView; |
19 | |
20 | class KViewStateMaintainerBasePrivate; |
21 | |
22 | class KWIDGETSADDONS_EXPORT KViewStateMaintainerBase : public QObject |
23 | { |
24 | Q_OBJECT |
25 | public: |
26 | KViewStateMaintainerBase(QObject *parent = nullptr); |
27 | ~KViewStateMaintainerBase() override; |
28 | |
29 | void setSelectionModel(QItemSelectionModel *selectionModel); |
30 | QItemSelectionModel *selectionModel() const; |
31 | |
32 | void setView(QAbstractItemView *view); |
33 | QAbstractItemView *view() const; |
34 | |
35 | virtual void saveState() = 0; |
36 | virtual void restoreState() = 0; |
37 | |
38 | private: |
39 | Q_DECLARE_PRIVATE(KViewStateMaintainerBase) |
40 | std::unique_ptr<KViewStateMaintainerBasePrivate> const d_ptr; |
41 | }; |
42 | |
43 | #endif |
44 | |