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 KIS_RESOURCE_THUMBNAIL_PAINTER_H
0009 #define KIS_RESOURCE_THUMBNAIL_PAINTER_H
0010 
0011 #include <QAbstractItemDelegate>
0012 
0013 #include "KoCheckerBoardPainter.h"
0014 
0015 #include "kritaresourcewidgets_export.h"
0016 #include <KisResourceTypes.h>
0017 #include <QObject>
0018 
0019 /// The resource item delegate for rendering the resource preview
0020 class KRITARESOURCEWIDGETS_EXPORT KisResourceThumbnailPainter : public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit KisResourceThumbnailPainter(QObject *parent = 0);
0025     ~KisResourceThumbnailPainter() override {}
0026 
0027     //  (QPainter*, QModelIndex&, QRect, const QPalette&, bool)’
0028 
0029     QImage getReadyThumbnail(const QModelIndex& index, QSize rect, const QPalette& palette) const;
0030     void paint(QPainter *painter,
0031                const QModelIndex &index,
0032                QRect rect,
0033                const QPalette &palette,
0034                bool selected,
0035                bool addMargin) const;
0036 
0037 private:
0038     KoCheckerBoardPainter m_checkerPainter;
0039 };
0040 
0041 #endif