[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [zanshin] src/widgets: Repair task delegation handling
From: Kevin Ottens <ervin () kde ! org>
Date: 2016-12-06 7:30:29
Message-ID: E1cEACr-0007XH-D8 () code ! kde ! org
[Download RAW message or body]
Git commit 65cc59bafd26aa17a305f9b6124fa03c76d7e4f5 by Kevin Ottens.
Committed on 06/12/2016 at 07:30.
Pushed by ervin into branch 'master'.
Repair task delegation handling
Summary:
Got broken in the previous big change when we dealt with different
sizes, now repair it properly.
Reviewers: #zanshin, dfaure
Differential Revision: https://phabricator.kde.org/D3600
M +5 -3 src/widgets/itemdelegate.cpp
https://commits.kde.org/zanshin/65cc59bafd26aa17a305f9b6124fa03c76d7e4f5
diff --git a/src/widgets/itemdelegate.cpp b/src/widgets/itemdelegate.cpp
index 55b0c16f..52441ed6 100644
--- a/src/widgets/itemdelegate.cpp
+++ b/src/widgets/itemdelegate.cpp
@@ -85,11 +85,14 @@ void ItemDelegate::paint(QPainter *painter,
const auto pastDueDate = dueDate.isValid() && dueDate.date() < \
QDate::currentDate();
const auto onDueDate = dueDate.isValid() && dueDate.date() == \
QDate::currentDate();
+ const auto taskDelegate = task ? task->delegate() : \
Domain::Task::Delegate(); +
const auto baseFont = opt.font;
const auto summaryFont = [=] {
auto font = baseFont;
font.setStrikeOut(isDone);
font.setBold(!isDone && (onStartDate || onDueDate || \
pastDueDate)); + font.setItalic(taskDelegate.isValid());
return font;
}();
const auto summaryMetrics = QFontMetrics(summaryFont);
@@ -105,8 +108,7 @@ void ItemDelegate::paint(QPainter *painter,
: onDueDate ? QColor("orange")
: baseColor;
- const auto hasDelegate = task && task->delegate().isValid();
- const auto summaryText = hasDelegate ? tr("(%1) \
%2").arg(task->delegate().display(), opt.text) : opt.text; + const auto \
summaryText = taskDelegate.isValid() ? tr("(%1) \
%2").arg(taskDelegate.display(), opt.text) : opt.text;
const auto dueDateText = dueDate.isValid() ? \
QLocale().toString(dueDate.date(), QLocale::ShortFormat) : QString();
@@ -137,7 +139,7 @@ void ItemDelegate::paint(QPainter *painter,
painter->setPen(summaryColor);
painter->setFont(summaryFont);
painter->drawText(summaryRect, Qt::AlignVCenter,
- summaryMetrics.elidedText(opt.text, \
Qt::ElideRight, summaryRect.width())); + \
summaryMetrics.elidedText(summaryText, Qt::ElideRight, \
summaryRect.width())); }
// Draw the due date
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic