File indexing completed on 2024-04-28 03:59:17

0001 /*
0002     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0003     SPDX-FileContributor: Stephen Kelly <stephen@kdab.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KVIEWSTATEMAINTAINERBASE_H
0009 #define KVIEWSTATEMAINTAINERBASE_H
0010 
0011 #include "kwidgetsaddons_export.h"
0012 
0013 #include <QObject>
0014 
0015 #include <memory>
0016 
0017 class QItemSelectionModel;
0018 class QAbstractItemView;
0019 
0020 class KViewStateMaintainerBasePrivate;
0021 
0022 class KWIDGETSADDONS_EXPORT KViewStateMaintainerBase : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     KViewStateMaintainerBase(QObject *parent = nullptr);
0027     ~KViewStateMaintainerBase() override;
0028 
0029     void setSelectionModel(QItemSelectionModel *selectionModel);
0030     QItemSelectionModel *selectionModel() const;
0031 
0032     void setView(QAbstractItemView *view);
0033     QAbstractItemView *view() const;
0034 
0035     virtual void saveState() = 0;
0036     virtual void restoreState() = 0;
0037 
0038 private:
0039     Q_DECLARE_PRIVATE(KViewStateMaintainerBase)
0040     std::unique_ptr<KViewStateMaintainerBasePrivate> const d_ptr;
0041 };
0042 
0043 #endif