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
12
struct
KisSnapshotView::Private
13
{
14
KisSnapshotModel
*
model
;
15
};
16
17
KisSnapshotView::KisSnapshotView
()
18
: QListView()
19
, m_d(new
Private
)
20
{
21
setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
22
}
23
24
KisSnapshotView::~KisSnapshotView
()
25
{
26
}
27
28
void
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
37
void
KisSnapshotView::slotSwitchToSelectedSnapshot
()
38
{
39
KIS_ASSERT_RECOVER_RETURN
(
m_d
->model);
40
QModelIndexList
indexes = selectedIndexes();
41
if
(indexes.size() != 1) {
42
return
;
43
}
44
m_d
->model->slotSwitchToSnapshot(indexes[0]);
45
}
46
47
void
KisSnapshotView::slotRemoveSelectedSnapshot
()
48
{
49
KIS_ASSERT_RECOVER_RETURN
(
m_d
->model);
50
QModelIndexList
indexes = selectedIndexes();
51
Q_FOREACH (QModelIndex index, indexes) {
52
m_d
->model->slotRemoveSnapshot(index);
53
}
54
}
55
KisSnapshotModel.h
KisSnapshotView.h
KisSnapshotModel
Definition
KisSnapshotModel.h:17
KisSnapshotView::setModel
void setModel(QAbstractItemModel *model) override
Definition
KisSnapshotView.cpp:28
KisSnapshotView::KisSnapshotView
KisSnapshotView()
Definition
KisSnapshotView.cpp:17
KisSnapshotView::~KisSnapshotView
~KisSnapshotView() override
Definition
KisSnapshotView.cpp:24
KisSnapshotView::slotSwitchToSelectedSnapshot
void slotSwitchToSelectedSnapshot()
Definition
KisSnapshotView.cpp:37
KisSnapshotView::slotRemoveSelectedSnapshot
void slotRemoveSelectedSnapshot()
Definition
KisSnapshotView.cpp:47
KisSnapshotView::m_d
QScopedPointer< Private > m_d
Definition
KisSnapshotView.h:25
QList< QModelIndex >
kis_assert.h
KIS_ASSERT_RECOVER_RETURN
#define KIS_ASSERT_RECOVER_RETURN(cond)
Definition
kis_assert.h:75
Private
Definition
SvgTransformParser.cpp:20
KisSnapshotView::Private
Definition
KisSnapshotView.cpp:13
KisSnapshotView::Private::model
KisSnapshotModel * model
Definition
KisSnapshotView.cpp:14
plugins
dockers
snapshotdocker
KisSnapshotView.cpp
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52