1 /* 2 SPDX-FileCopyrightText: 2009 Stefan Majewsky <majewsky@gmx.net> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef PALAPELI_COLLECTIONDELEGATE_H 8 #define PALAPELI_COLLECTIONDELEGATE_H 9 10 #include <QStyledItemDelegate> 11 12 namespace Palapeli 13 { 14 class CollectionDelegate : public QStyledItemDelegate 15 { 16 public: 17 explicit CollectionDelegate (QObject* parent = nullptr); 18 19 void paint (QPainter* painter, 20 const QStyleOptionViewItem& option, 21 const QModelIndex& index) const override; 22 QSize sizeHint (const QStyleOptionViewItem& option, 23 const QModelIndex& index) const override; 24 25 private: 26 QRect thumbnailRect (const QRect& baseRect) const; 27 QWidget * m_viewport; 28 }; 29 } 30 31 #endif // PALAPELI_COLLECTIONDELEGATE_H 32