Improve item delegates

This commit is contained in:
Martchus 2016-08-27 15:27:13 +02:00
parent bb9140bcc7
commit 634f46f525
3 changed files with 4 additions and 6 deletions

View File

@ -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:

View File

@ -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();

View File

@ -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