[Kst] extragear/graphics/kst/src/libkstapp
Andrew Walker
arwalker at sumusltd.com
Wed Feb 22 19:11:40 CET 2006
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