File indexing completed on 2024-05-19 04:27:45

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2008 Jan Hambrecht <jaham@gmx.net>
0003  * SPDX-FileCopyrightText: 2018 Boudewijn Rempt <boud@valdyas.org>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #ifndef KISRESOURCEITEMDELEGATE_H
0009 #define KISRESOURCEITEMDELEGATE_H
0010 
0011 #include <QAbstractItemDelegate>
0012 
0013 #include "KisResourceThumbnailPainter.h"
0014 #include "KoCheckerBoardPainter.h"
0015 #include "kritaresourcewidgets_export.h"
0016 
0017 /// The resource item delegate for rendering the resource preview
0018 class KRITARESOURCEWIDGETS_EXPORT KisResourceItemDelegate : public QAbstractItemDelegate
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit KisResourceItemDelegate(QObject *parent = 0);
0023     ~KisResourceItemDelegate() override {}
0024 
0025     void paint( QPainter *, const QStyleOptionViewItem &, const QModelIndex & ) const override;
0026     void setShowText(bool);
0027     void setIsWidget(bool);
0028 
0029     QSize sizeHint ( const QStyleOptionViewItem &, const QModelIndex & ) const override;
0030 
0031 private:
0032     KoCheckerBoardPainter m_checkerPainter;
0033     KisResourceThumbnailPainter m_thumbnailPainter;
0034     bool m_showText;
0035     bool m_isWidget;
0036 };
0037 
0038 #endif