File indexing completed on 2024-05-19 04:07:52
0001 /* 0002 SPDX-FileCopyrightText: 2009 Stefan Majewsky <majewsky@gmx.net> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef PALAPELI_COLLECTIONDELEGATE_H 0008 #define PALAPELI_COLLECTIONDELEGATE_H 0009 0010 #include <QStyledItemDelegate> 0011 0012 namespace Palapeli 0013 { 0014 class CollectionDelegate : public QStyledItemDelegate 0015 { 0016 public: 0017 explicit CollectionDelegate (QObject* parent = nullptr); 0018 0019 void paint (QPainter* painter, 0020 const QStyleOptionViewItem& option, 0021 const QModelIndex& index) const override; 0022 QSize sizeHint (const QStyleOptionViewItem& option, 0023 const QModelIndex& index) const override; 0024 0025 private: 0026 QRect thumbnailRect (const QRect& baseRect) const; 0027 QWidget * m_viewport; 0028 }; 0029 } 0030 0031 #endif // PALAPELI_COLLECTIONDELEGATE_H