File indexing completed on 2024-05-05 17:09:08
0001 /* 0002 * This file is part of the KDE project 0003 * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program; if not, write to the Free Software 0017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef CQSPREADSHEETLISTMODEL_H 0021 #define CQSPREADSHEETLISTMODEL_H 0022 0023 #include <QAbstractListModel> 0024 0025 class CQSpreadsheetListModel : public QAbstractListModel 0026 { 0027 Q_OBJECT 0028 Q_PROPERTY(QObject* canvas READ canvas WRITE setCanvas NOTIFY canvasChanged) 0029 Q_PROPERTY(QSize thumbnailSize READ thumbnailSize WRITE setThumbnailSize NOTIFY thumbnailSizeChanged) 0030 0031 public: 0032 enum RoleNames { 0033 SheetNameRole = Qt::UserRole, 0034 ThumbnailRole 0035 }; 0036 0037 explicit CQSpreadsheetListModel(QObject* parent = 0); 0038 virtual ~CQSpreadsheetListModel(); 0039 0040 virtual QVariant data(const QModelIndex& index, int role) const; 0041 virtual int rowCount(const QModelIndex& parent) const; 0042 0043 QObject* canvas() const; 0044 0045 QSize thumbnailSize() const; 0046 0047 public Q_SLOTS: 0048 void setCanvas(QObject* canvas); 0049 void setThumbnailSize(const QSize& size); 0050 0051 Q_SIGNALS: 0052 void canvasChanged(); 0053 void thumbnailSizeChanged(); 0054 0055 private: 0056 class Private; 0057 Private * const d; 0058 }; 0059 0060 #endif // CQSPREADSHEETLISTMODEL_H