Summary: | Legend size is incorret with no entries | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Andrew Walker <arwalker> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Proposed patch |
Description
Andrew Walker
2006-02-22 02:04:31 UTC
Created attachment 14804 [details]
Proposed patch
The patch looks good. Please apply. 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; |