mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-08 16:42:30 -06:00
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:
committed by
sledgehammer999
parent
6fc50f4169
commit
2b6e1953d7
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user