File indexing completed on 2024-05-05 05:13:10

0001 /*
0002     This file is part of Akregator.
0003 
0004     SPDX-FileCopyrightText: 2007 Frank Osterfeld <osterfeld@kde.org>
0005     SPDX-FileCopyrightText: 2009 Jonathan Marten <jjm@keelhaul.me.uk>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0008 */
0009 
0010 #pragma once
0011 
0012 #include <QStyledItemDelegate>
0013 
0014 namespace Akregator
0015 {
0016 class SubscriptionListDelegate : public QStyledItemDelegate
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit SubscriptionListDelegate(QWidget *parent = nullptr);
0022     ~SubscriptionListDelegate() override;
0023 
0024 protected:
0025     [[nodiscard]] QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0026 
0027     void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0028 
0029     void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override;
0030 
0031 private:
0032     void recalculateRowHeight();
0033     int m_viewIconHeight = 0;
0034 };
0035 }