File indexing completed on 2024-05-12 13:04:47

0001 /*
0002  * This file is part of the KDE project
0003  *
0004  * SPDX-FileCopyrightText: 2014 Dan Leinir Turthra Jensen <admin@leinir.dk>
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007  *
0008  */
0009 
0010 #ifndef CQTEXTDOCUMENTNOTESMODEL_H
0011 #define CQTEXTDOCUMENTNOTESMODEL_H
0012 
0013 #include <QAbstractListModel>
0014 #include <KoShape.h>
0015 
0016 class CQTextDocumentNotesModel : public QAbstractListModel
0017 {
0018     Q_OBJECT
0019     Q_PROPERTY(int count READ count NOTIFY countChanged)
0020 public:
0021     enum NoteRoles {
0022         Text = Qt::UserRole + 1,
0023         Image,
0024         Color,
0025         ColorCount,
0026         CategoryName,
0027         FirstOfThisColor,
0028         Position,
0029         Expanded
0030     };
0031     explicit CQTextDocumentNotesModel(QObject* parent = 0);
0032     virtual ~CQTextDocumentNotesModel();
0033 
0034     virtual QVariant data(const QModelIndex& index, int role) const;
0035     virtual int rowCount(const QModelIndex& parent) const;
0036     int count() const;
0037 
0038     Q_INVOKABLE void toggleExpanded(int index);
0039     void addEntry(const QString& text, const QString& image, const QString& color, KoShape* shape);
0040 
0041 Q_SIGNALS:
0042     void countChanged();
0043 
0044 private:
0045     class Private;
0046     Private* const d;
0047 };
0048 
0049 #endif // CQTEXTDOCUMENTNOTESMODEL_H