[Pkg-owncloud-commits] [owncloud-client] 85/171: Fix the rendering of the red error box text

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.

commit ce6f90397a28b1703a762a9f7d43ec53c01d59f8
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Thu Jan 7 17:56:14 2016 +0100

    Fix the rendering of the red error box text
    
    QPainter::drawText uses the top of the font for the y position of its
    rect argument, but uses the baseline when using a point argument.
    
    Also use the margin variable that matches the font used instead of
    the aliasMargin and make sure that the margin is only added between
    the box and the text once.
---
 src/gui/folderstatusdelegate.cpp | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/gui/folderstatusdelegate.cpp b/src/gui/folderstatusdelegate.cpp
index 7b5c351..28e6b60 100644
--- a/src/gui/folderstatusdelegate.cpp
+++ b/src/gui/folderstatusdelegate.cpp
@@ -244,12 +244,12 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
 
     int h = iconRect.bottom();
     if( !errorTexts.isEmpty() ) {
-        h += aliasMargin;
+        h += margin;
         QRect errorRect = localPathRect;
         errorRect.setLeft( iconRect.left());
         errorRect.setTop( h );
-        errorRect.setHeight(errorTexts.count() * subFm.height()+aliasMargin);
-        errorRect.setRight( option.rect.right()-aliasMargin );
+        errorRect.setHeight(errorTexts.count() * subFm.height() + 2 * margin);
+        errorRect.setRight( option.rect.right() - margin );
 
         painter->setBrush( QColor(0xbb, 0x4d, 0x4d) );
         painter->setPen( QColor(0xaa, 0xaa, 0xaa));
@@ -257,23 +257,20 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
                                  4, 4);
         painter->setPen( Qt::white );
         painter->setFont(errorFont);
-        QRect errorTextRect = errorRect;
-        errorTextRect.setLeft( errorTextRect.left()+aliasMargin );
-        errorTextRect.setTop( errorTextRect.top()+aliasMargin/2 );
-
-        int x = errorTextRect.left();
-        int y = errorTextRect.top()+aliasMargin/2 + subFm.height()/2;
+        QRect errorTextRect( errorRect.left() + margin,
+            errorRect.top() + margin,
+            errorRect.width() - 2 * margin,
+            subFm.height() );
 
         foreach( QString eText, errorTexts ) {
-            QRect lineRect = QRect(x, y, errorTextRect.width(), subFm.height());
-            painter->drawText(QStyle::visualRect(option.direction, option.rect, lineRect), textAlign,
-                              subFm.elidedText( eText, Qt::ElideLeft, errorTextRect.width()-2*aliasMargin));
-            y += lineRect.height();
+            painter->drawText(QStyle::visualRect(option.direction, option.rect, errorTextRect), textAlign,
+                              subFm.elidedText( eText, Qt::ElideLeft, errorTextRect.width()));
+            errorTextRect.translate(0, errorTextRect.height());
         }
 
         h = errorRect.bottom();
     }
-    h += aliasMargin;
+    h += margin;
 
     // Sync File Progress Bar: Show it if syncFile is not empty.
     if (showProgess) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list