Improve item delegates
This commit is contained in:
parent
bb9140bcc7
commit
634f46f525
|
@ -18,8 +18,7 @@ ComboBoxItemDelegate::~ComboBoxItemDelegate()
|
||||||
|
|
||||||
bool ComboBoxItemDelegate::ComboBoxItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
bool ComboBoxItemDelegate::ComboBoxItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||||
{
|
{
|
||||||
switch(event->type())
|
switch(event->type()) {
|
||||||
{
|
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
return false;
|
return false;
|
||||||
case QEvent::GraphicsSceneWheel:
|
case QEvent::GraphicsSceneWheel:
|
||||||
|
|
|
@ -20,7 +20,6 @@ void ProgressBarItemDelegate::paint(QPainter *painter, const QStyleOptionViewIte
|
||||||
progressBarOption.state = QStyle::State_Enabled;
|
progressBarOption.state = QStyle::State_Enabled;
|
||||||
progressBarOption.direction = QApplication::layoutDirection();
|
progressBarOption.direction = QApplication::layoutDirection();
|
||||||
progressBarOption.rect = option.rect;
|
progressBarOption.rect = option.rect;
|
||||||
progressBarOption.fontMetrics = QApplication::fontMetrics();
|
|
||||||
progressBarOption.textAlignment = Qt::AlignCenter;
|
progressBarOption.textAlignment = Qt::AlignCenter;
|
||||||
progressBarOption.textVisible = true;
|
progressBarOption.textVisible = true;
|
||||||
progressBarOption.progress = index.model()->data(index, DownloadModel::ProgressPercentageRole).toInt();
|
progressBarOption.progress = index.model()->data(index, DownloadModel::ProgressPercentageRole).toInt();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef PROGRESSBARDELEGATE_H
|
#ifndef PROGRESSBARITEMDELEGATE_H
|
||||||
#define PROGRESSBARDELEGATE_H
|
#define PROGRESSBARITEMDELEGATE_H
|
||||||
|
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
|
@ -15,4 +15,4 @@ public:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DOWNLOADSVIEWDELEGATE_H
|
#endif // PROGRESSBARITEMDELEGATE_H
|
||||||
|
|
Loading…
Reference in New Issue