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 BOOKDELEGATE_H
|
|
|
|
#define BOOKDELEGATE_H
|
|
|
|
|
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QSize>
|
|
|
|
#include <QSqlRelationalDelegate>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QPainter)
|
|
|
|
|
|
|
|
class BookDelegate : public QSqlRelationalDelegate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BookDelegate(QObject *parent);
|
|
|
|
|
|
|
|
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
|
|
|
|
2018-06-05 11:55:43 +00:00
|
|
|
QSize sizeHint(const QStyleOptionViewItem &option,
|
|
|
|
const QModelIndex &index) const override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
|
|
|
const QStyleOptionViewItem &option,
|
2016-06-15 08:12:35 +00:00
|
|
|
const QModelIndex &index) override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
2018-06-05 12:04:04 +00:00
|
|
|
const QModelIndex &index) const override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QPixmap star;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|