Krita Source Code Documentation
Loading...
Searching...
No Matches
kundo2model.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2010 Matus Talcik <matus.talcik@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6/****************************************************************************
7**
8** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
9** All rights reserved.
10** Contact: Nokia Corporation (qt-info@nokia.com)
11**
12** This file is part of the QtGui module of the Qt Toolkit.
13**
14** $QT_BEGIN_LICENSE:LGPL$
15** No Commercial Usage
16** This file contains pre-release code and may not be distributed.
17** You may use this file in accordance with the terms and conditions
18** contained in the Technology Preview License Agreement accompanying
19** this package.
20**
21** GNU Lesser General Public License Usage
22** Alternatively, this file may be used under the terms of the GNU Lesser
23** General Public License version 2.1 as published by the Free Software
24** Foundation and appearing in the file LICENSE.LGPL included in the
25** packaging of this file. Please review the following information to
26** ensure the GNU Lesser General Public License version 2.1 requirements
27** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
28**
29** In addition, as a special exception, Nokia gives you certain additional
30** rights. These rights are described in the Nokia Qt LGPL Exception
31** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
32**
33** If you have questions regarding the use of this file, please contact
34** Nokia at qt-info@nokia.com.
35**
36**
37**
38**
39**
40**
41**
42**
43** $QT_END_LICENSE$
44**
45****************************************************************************/
46#ifndef K_UNDO_2_MODEL
47#define K_UNDO_2_MODEL
48#include <QAbstractItemModel>
49
50#include "kundo2stack.h"
51#include <QItemSelectionModel>
52#include <QIcon>
53
54class KUndo2Model : public QAbstractItemModel
55{
56 Q_OBJECT
57public:
58 explicit KUndo2Model(QObject *parent = 0);
59
60 KUndo2QStack *stack() const;
61
62 QModelIndex index(int row, int column,
63 const QModelIndex &parent = QModelIndex()) const override;
64 QModelIndex parent(const QModelIndex &child) const override;
65 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
66 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
67 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
68
69 QModelIndex selectedIndex() const;
70 QItemSelectionModel *selectionModel() const;
71
72 QString emptyLabel() const;
73 void setEmptyLabel(const QString &label);
74
75 void setCleanIcon(const QIcon &icon);
76 QIcon cleanIcon() const;
77
78public Q_SLOTS:
80
81private Q_SLOTS:
82 void stackChanged();
83 void stackDestroyed(QObject *obj);
84 void setStackCurrentIndex(const QModelIndex &index);
85
86private:
88 QItemSelectionModel *m_sel_model;
91};
92#endif
void stackChanged()
QModelIndex parent(const QModelIndex &child) const override
KUndo2QStack * m_stack
Definition kundo2model.h:87
QString emptyLabel() const
void setEmptyLabel(const QString &label)
QIcon m_clean_icon
Definition kundo2model.h:90
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
void setCleanIcon(const QIcon &icon)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QIcon cleanIcon() const
QModelIndex selectedIndex() const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
KUndo2Model(QObject *parent=0)
QItemSelectionModel * m_sel_model
Definition kundo2model.h:88
void setStack(KUndo2QStack *stack)
QItemSelectionModel * selectionModel() const
QString m_empty_label
Definition kundo2model.h:89
void setStackCurrentIndex(const QModelIndex &index)
KUndo2QStack * stack() const
void stackDestroyed(QObject *obj)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
The KUndo2QStack class is a stack of KUndo2Command objects.