File Do-not-call-base-class-rendering-of-column-when-rendering-progressbar-on-top.patch of Package apper4
From af7605e19245cc07141b48a395b4297f6c112deb Mon Sep 17 00:00:00 2001
From: Hugo Pereira Da Costa <hugo.pereira.da.costa@gmail.com>
Date: Sun, 26 Feb 2017 17:20:32 +0100
Subject: Do not call base class rendering of column when rendering progressbar
on top. This fixes progress download rendering for Breeze.
Differential Revision: https://phabricator.kde.org/D4812
---
libapper/TransactionDelegate.cpp | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/libapper/TransactionDelegate.cpp b/libapper/TransactionDelegate.cpp
index f60f4f7..1354f91 100644
--- a/libapper/TransactionDelegate.cpp
+++ b/libapper/TransactionDelegate.cpp
@@ -39,11 +39,6 @@ void TransactionDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
- QStyleOptionViewItemV4 opt1(option);
- if (opt1.state & QStyle::State_HasFocus) {
- opt1.state ^= QStyle::State_HasFocus;
- }
- QStyledItemDelegate::paint(painter, opt1, index);
if (index.column() == 0 && !index.data(PkTransactionProgressModel::RoleRepo).toBool()) {
int progress = index.data(PkTransactionProgressModel::RoleProgress).toInt();
QString text = index.data(Qt::DisplayRole).toString();
@@ -51,7 +46,7 @@ void TransactionDelegate::paint(QPainter *painter,
QStyleOptionProgressBarV2 progressBarOption;
progressBarOption.state = QStyle::State_Enabled;
progressBarOption.direction = QApplication::layoutDirection();
- progressBarOption.rect = opt1.rect;
+ progressBarOption.rect = option.rect;
progressBarOption.fontMetrics = QApplication::fontMetrics();
progressBarOption.minimum = 0;
progressBarOption.maximum = 100;
@@ -61,6 +56,12 @@ void TransactionDelegate::paint(QPainter *painter,
progressBarOption.textVisible = true;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter);
+ } else {
+ QStyleOptionViewItemV4 opt1(option);
+ if (opt1.state & QStyle::State_HasFocus) {
+ opt1.state ^= QStyle::State_HasFocus;
+ }
+ QStyledItemDelegate::paint(painter, opt1, index);
}
}
--
cgit v0.11.2