[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/plugins/textshape
From:       Thomas Zander <zander () kde ! org>
Date:       2010-12-23 15:57:42
Message-ID: 20101223155742.08B263E1FB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1208889 by zander:

Paint background between paragraphs

 M  +18 -2     Layout.cpp  


--- trunk/koffice/plugins/textshape/Layout.cpp #1208888:1208889
@@ -1159,8 +1159,24 @@
 
             painter->save();
             QBrush bg = paintStrategy->background(block.blockFormat().background());
-            if (bg != Qt::NoBrush)
-                painter->fillRect(layout->boundingRect(), bg);
+            if (bg != Qt::NoBrush) {
+                QRectF background(layout->boundingRect());
+                QTextBlock prev = block.previous();
+                if (prev.isValid() && prev.blockFormat().background() == bg) {
+                    qreal bottom = prev.layout()->boundingRect().bottom();
+                    if (bottom < background.top())
+                        background.setTop(bottom);
+                }
+                QTextBlock next = block.next();
+                if (next.isValid() && next.layout()->lineCount() > 0
+                        && next.blockFormat().background() == bg) {
+                    qreal top = next.layout()->lineAt(0).y();
+                    if (top > background.bottom())
+                        background.setBottom(top);
+                }
+
+                painter->fillRect(background, bg);
+            }
             paintStrategy->applyStrategy(painter);
             painter->save();
             drawListItem(painter, block, context.imageCollection);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic