2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef PIXELDELEGATE_H
|
|
|
|
#define PIXELDELEGATE_H
|
|
|
|
|
|
|
|
#include <QAbstractItemDelegate>
|
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QSize>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QAbstractItemModel;
|
|
|
|
class QObject;
|
|
|
|
class QPainter;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2018-11-24 16:29:15 +00:00
|
|
|
static constexpr int ItemSize = 256;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
//! [0]
|
|
|
|
class PixelDelegate : public QAbstractItemDelegate
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-11-24 16:29:15 +00:00
|
|
|
PixelDelegate(QObject *parent = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
2016-06-15 08:12:35 +00:00
|
|
|
const QModelIndex &index) const override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QSize sizeHint(const QStyleOptionViewItem &option,
|
2018-11-24 16:29:15 +00:00
|
|
|
const QModelIndex &index) const override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setPixelSize(int size);
|
|
|
|
|
|
|
|
private:
|
|
|
|
int pixelSize;
|
|
|
|
};
|
|
|
|
//! [0]
|
|
|
|
|
2012-11-22 12:40:51 +00:00
|
|
|
#endif // PIXELDELEGATE_H
|