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 CQPRESENTATIONMODEL_H 0009 #define CQPRESENTATIONMODEL_H 0010 0011 #include <QAbstractListModel> 0012 #include <QPixmap> 0013 0014 class QDeclarativeItem; 0015 class CQPresentationModel : public QAbstractListModel 0016 { 0017 Q_OBJECT 0018 Q_PROPERTY(QDeclarativeItem* canvas READ canvas WRITE setCanvas NOTIFY canvasChanged) 0019 Q_PROPERTY(QSizeF thumbnailSize READ thumbnailSize WRITE setThumbnailSize NOTIFY thumbnailSizeChanged) 0020 0021 public: 0022 enum Roles { 0023 ThumbnailRole = Qt::UserRole, 0024 }; 0025 0026 explicit CQPresentationModel(QObject* parent = 0); 0027 ~CQPresentationModel(); 0028 0029 virtual QVariant data(const QModelIndex& index, int role) const; 0030 virtual int rowCount(const QModelIndex& parent) const; 0031 0032 Q_INVOKABLE QPixmap thumbnail(int index) const; 0033 0034 QDeclarativeItem* canvas() const; 0035 0036 QSizeF thumbnailSize() const; 0037 0038 public Q_SLOTS: 0039 void setCanvas(QDeclarativeItem* canvas); 0040 void setThumbnailSize(const QSizeF& size); 0041 void canvasSourceChanged(); 0042 0043 Q_SIGNALS: 0044 void canvasChanged(); 0045 void thumbnailSizeChanged(); 0046 0047 private: 0048 class Private; 0049 Private * const d; 0050 }; 0051 0052 #endif // CQPRESENTATIONMODEL_H