File indexing completed on 2024-03-24 17:23:01

0001 // SPDX-FileCopyrightText: 2020 Simon Persson <simon.persson@mykolab.com>
0002 //
0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #ifndef DRIVESELECTIONDELEGATE_H
0006 #define DRIVESELECTIONDELEGATE_H
0007 
0008 #include <QStyledItemDelegate>
0009 
0010 class QListView;
0011 class KCapacityBar;
0012 
0013 class DriveSelectionDelegate : public QStyledItemDelegate
0014 {
0015 public:
0016     explicit DriveSelectionDelegate(QListView *pParent);
0017     ~DriveSelectionDelegate() override;
0018     void paint(QPainter* pPainter, const QStyleOptionViewItem& pOption, const QModelIndex& pIndex) const override;
0019     QSize sizeHint(const QStyleOptionViewItem& pOption, const QModelIndex& pIndex) const override;
0020 private:
0021     QRect warningRect(const QRect &pRect, const QModelIndex &pIndex) const;
0022     static QString warningText(const QModelIndex &pIndex);
0023     KCapacityBar *mCapacityBar;
0024     QListView *mListView;
0025 };
0026 
0027 #endif // DRIVESELECTIONDELEGATE_H