File indexing completed on 2024-12-22 04:14:57
0001 /* 0002 * SPDX-FileCopyrightText: 2019 Tusooa Zhu <tusooa@vista.aero> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KIS_SNAPSHOT_MODEL_H_ 0008 #define KIS_SNAPSHOT_MODEL_H_ 0009 0010 #include <QAbstractListModel> 0011 #include <QScopedPointer> 0012 #include <QPointer> 0013 0014 #include <kis_canvas2.h> 0015 0016 class KisSnapshotModel : public QAbstractListModel 0017 { 0018 public: 0019 KisSnapshotModel(); 0020 ~KisSnapshotModel() override; 0021 0022 int rowCount(const QModelIndex &parent) const override; 0023 QVariant data(const QModelIndex &index, int role) const override; 0024 bool setData(const QModelIndex &index, const QVariant &value, int role) override; 0025 // this function is re-implemented to make the items editable 0026 Qt::ItemFlags flags(const QModelIndex &index) const override; 0027 void setCanvas(QPointer<KisCanvas2> canvas); 0028 0029 public Q_SLOTS: 0030 bool slotCreateSnapshot(); 0031 bool slotRemoveSnapshot(const QModelIndex &index); 0032 bool slotSwitchToSnapshot(const QModelIndex &index); 0033 0034 private: 0035 struct Private; 0036 QScopedPointer<Private> m_d; 0037 }; 0038 0039 #endif // KIS_SNAPSHOT_MODEL_H_