Version: HEAD (using KDE KDE 3.5.0) Installed from: Compiled From Sources OS: Linux STEPS TO REPRODUCE: Start kst Create a plot with a single curve make the legend visible Edit the legend and empty the Display objects list Hit Apply RESULTS: In vertical mode height of legend extends beyond plot In horizontal mode legend has no width EXPECTED RESULTS: A reasonable default size for each case
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;