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

0001 /*
0002  * This file is part of the KDE project
0003  * SPDX-FileCopyrightText: 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef CQSPREADSHEETLISTMODEL_H
0009 #define CQSPREADSHEETLISTMODEL_H
0010 
0011 #include <QAbstractListModel>
0012 
0013 class CQSpreadsheetListModel : public QAbstractListModel
0014 {
0015     Q_OBJECT
0016     Q_PROPERTY(QObject* canvas READ canvas WRITE setCanvas NOTIFY canvasChanged)
0017     Q_PROPERTY(QSize thumbnailSize READ thumbnailSize WRITE setThumbnailSize NOTIFY thumbnailSizeChanged)
0018 
0019 public:
0020     enum RoleNames {
0021         SheetNameRole = Qt::UserRole,
0022         ThumbnailRole
0023     };
0024 
0025     explicit CQSpreadsheetListModel(QObject* parent = 0);
0026     virtual ~CQSpreadsheetListModel();
0027 
0028     virtual QVariant data(const QModelIndex& index, int role) const;
0029     virtual int rowCount(const QModelIndex& parent) const;
0030 
0031     QObject* canvas() const;
0032 
0033     QSize thumbnailSize() const;
0034 
0035 public Q_SLOTS:
0036     void setCanvas(QObject* canvas);
0037     void setThumbnailSize(const QSize& size);
0038 
0039 Q_SIGNALS:
0040     void canvasChanged();
0041     void thumbnailSizeChanged();
0042 
0043 private:
0044     class Private;
0045     Private * const d;
0046 };
0047 
0048 #endif // CQSPREADSHEETLISTMODEL_H