Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorCamila San <hello@camila.codes>2018-07-30 20:59:04 +0300
committerCamila San <hello@camila.codes>2018-07-30 23:11:04 +0300
commit156b4cf284ed2f19be687c2048add8332fa9f696 (patch)
treeb00136c1abbb3d3eae420e1ccfb693a3d49f5e29 /src/gui
parentee612bda3a8fbdbb9515e18a446ddb7c8089b88f (diff)
Aligns time vertically on the bottom of the notification action text when there is no message.
- Minor fix: gives less space for long text that needed ellipses which was not showing and set right margin because otherwise text was not painted correctly and completly. Signed-off-by: Camila San <hello@camila.codes>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/activityitemdelegate.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/activityitemdelegate.cpp b/src/gui/activityitemdelegate.cpp
index e18fde193..e068872ac 100644
--- a/src/gui/activityitemdelegate.cpp
+++ b/src/gui/activityitemdelegate.cpp
@@ -110,9 +110,11 @@ void ActivityItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
// message text rect
QRect messageTextBox = actionTextBox;
+ int messageTextWidth = fm.width(messageText);
messageTextBox.setTop(option.rect.top() + fm.height() + margin);
- messageTextBox.setHeight(actionTextBox.height());
+ messageTextBox.setHeight(fm.height());
messageTextBox.setBottom(messageTextBox.top() + fm.height());
+ messageTextBox.setRight(messageTextBox.left() + messageTextWidth + margin);
if(messageText.isEmpty()){
messageTextBox.setHeight(0);
messageTextBox.setBottom(messageTextBox.top());
@@ -121,9 +123,13 @@ void ActivityItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
// time box rect
QRect timeBox = messageTextBox;
QString timeStr = tr("%1").arg(timeText);
- timeBox.setTop(option.rect.top() + fm.height() + fm.height() + margin + offset/2);
- timeBox.setHeight(actionTextBox.height());
+ int timeTextWidth = fm.width(timeStr);
+ int timeTop = option.rect.top() + fm.height() + fm.height() + margin + offset/2;
+ if(messageText.isEmpty()) timeTop = option.rect.top() + fm.height() + margin;
+ timeBox.setTop(timeTop);
+ timeBox.setHeight(fm.height());
timeBox.setBottom(timeBox.top() + fm.height());
+ timeBox.setRight(timeBox.left() + timeTextWidth + margin);
// buttons - default values
int rightMargin = margin;
@@ -231,7 +237,7 @@ void ActivityItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
painter->setPen(option.palette.color(cg, QPalette::Text));
// calculate space for text - use the max possible before using the elipses
- int spaceLeftForText = option.rect.width() - (actionIconRect.width() + margin) -
+ int spaceLeftForText = option.rect.width() - (actionIconRect.width() + margin + rightMargin + leftMargin) -
(_primaryButtonWidth + _secondaryButtonWidth + _spaceBetweenButtons);
// draw the subject