File indexing completed on 2024-05-05 17:09:09
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * Copyright 2014 Dan Leinir Turthra Jensen <admin@leinir.dk> 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License as 0008 * published by the Free Software Foundation; either version 2 of 0009 * the License or (at your option) version 3 or any later version 0010 * accepted by the membership of KDE e.V. (or its successor approved 0011 * by the membership of KDE e.V.), which shall act as a proxy 0012 * defined in Section 14 of version 3 of the license. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 * 0022 */ 0023 0024 #ifndef CQTEXTDOCUMENTNOTESMODEL_H 0025 #define CQTEXTDOCUMENTNOTESMODEL_H 0026 0027 #include <QAbstractListModel> 0028 #include <KoShape.h> 0029 0030 class CQTextDocumentNotesModel : public QAbstractListModel 0031 { 0032 Q_OBJECT 0033 Q_PROPERTY(int count READ count NOTIFY countChanged) 0034 public: 0035 enum NoteRoles { 0036 Text = Qt::UserRole + 1, 0037 Image, 0038 Color, 0039 ColorCount, 0040 CategoryName, 0041 FirstOfThisColor, 0042 Position, 0043 Expanded 0044 }; 0045 explicit CQTextDocumentNotesModel(QObject* parent = 0); 0046 virtual ~CQTextDocumentNotesModel(); 0047 0048 virtual QVariant data(const QModelIndex& index, int role) const; 0049 virtual int rowCount(const QModelIndex& parent) const; 0050 int count() const; 0051 0052 Q_INVOKABLE void toggleExpanded(int index); 0053 void addEntry(const QString& text, const QString& image, const QString& color, KoShape* shape); 0054 0055 Q_SIGNALS: 0056 void countChanged(); 0057 0058 private: 0059 class Private; 0060 Private* const d; 0061 }; 0062 0063 #endif // CQTEXTDOCUMENTNOTESMODEL_H