[Kst] [Bug 122458] Legend size is incorret with no entries

Andrew Walker arwalker at sumusltd.com
Wed Feb 22 19:12:48 CET 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=122458         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2006-02-22 19:12 -------
SVN commit 512513 by arwalker:

BUG:122458 Make legend size reasonable for zero entries

 M  +14 -6     kstviewlegend.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlegend.cpp #512512:512513
 @ -262,7 +262,7  @
       RenderContext rc(_fontName, _absFontSize, 0L);
       renderLabel(rc, (*it)->parsedLegendTag()->chunk);
       if (_vertical) {
-        if (rc.xMax>_textWidth) {
+        if (rc.xMax > _textWidth) {
           _textWidth = rc.xMax;
         }
       } else {
 @ -280,9 +280,17  @
   _ascent = rc.fontAscent();
 
   if (_vertical) {
-    _textHeight = _curves.count()*rc.fontHeight() + (_curves.count()-1)*_ascent/4;
+    if (_curves.count() > 0) {
+      _textHeight = _curves.count()*rc.fontHeight() + (_curves.count()-1)*_ascent/4;
+    } else {
+      _textHeight = _ascent/4;
+    }
   } else {
-    _textWidth += _curves.count()*_ascent;
+    if (_curves.count() > 0) {
+      _textWidth += _curves.count()*_ascent;
+    } else {
+      _textWidth += _ascent;
+    }
   }
 
   // determine title size
 @ -420,13 +428,13  @
   if (_vertical) {
     width = QMAX(_textWidth + 9*_ascent/2, _titleWidth);
     height = _textHeight;
-    if (_titleHeight>0) {
-      height+=_titleHeight;
+    if (_titleHeight > 0) {
+      height += _titleHeight;
     }
   } else {
     height = QMAX(_textHeight, _titleHeight);
 
-    if (_titleWidth>0) {
+    if (_titleWidth > 0) {
       width = _titleWidth + _textWidth + 9*_ascent*_curves.count()/2;
     } else {
       width = _textWidth + 9*_ascent*_curves.count()/2 - _ascent;


More information about the Kst mailing list