Use ProgressbarDelegate for drawing progressbar in PropListDelegate

Also directly provide display data from model rather then generating it in delegate
This commit is contained in:
jagannatharjun
2020-10-24 12:57:46 +05:30
committed by sledgehammer999
parent 6fc50f4169
commit 2b6e1953d7
9 changed files with 115 additions and 122 deletions

View File

@@ -29,7 +29,7 @@
#ifndef PROPLISTDELEGATE_H
#define PROPLISTDELEGATE_H
#include <QStyledItemDelegate>
#include "gui/progressbardelegate.h"
class QAbstractItemModel;
class QModelIndex;
@@ -49,14 +49,13 @@ enum PropColumn
AVAILABILITY
};
class PropListDelegate final : public QStyledItemDelegate
class PropListDelegate final : public ProgressBarDelegate
{
Q_OBJECT
public:
explicit PropListDelegate(PropertiesWidget *properties);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem & /* option */, const QModelIndex &index) const override;
@@ -68,6 +67,8 @@ signals:
void filteredFilesChanged() const;
private:
void initProgressStyleOption(QStyleOptionProgressBar &option, const QModelIndex &index) const override;
PropertiesWidget *m_properties;
};