Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSnapshotView.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Tusooa Zhu <tusooa@vista.aero>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#include "KisSnapshotView.h"
8#include "KisSnapshotModel.h"
9
10#include <kis_assert.h>
11
16
18 : QListView()
19 , m_d(new Private)
20{
21 setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
22}
23
27
28void KisSnapshotView::setModel(QAbstractItemModel *model)
29{
30 KisSnapshotModel *snapshotModel = dynamic_cast<KisSnapshotModel *>(model);
31 if (snapshotModel) {
32 QListView::setModel(model);
33 m_d->model = snapshotModel;
34 }
35}
36
38{
40 QModelIndexList indexes = selectedIndexes();
41 if (indexes.size() != 1) {
42 return;
43 }
44 m_d->model->slotSwitchToSnapshot(indexes[0]);
45}
46
48{
50 QModelIndexList indexes = selectedIndexes();
51 Q_FOREACH (QModelIndex index, indexes) {
52 m_d->model->slotRemoveSnapshot(index);
53 }
54}
55
void setModel(QAbstractItemModel *model) override
~KisSnapshotView() override
void slotSwitchToSelectedSnapshot()
void slotRemoveSelectedSnapshot()
QScopedPointer< Private > m_d
#define KIS_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:75