Version: HEAD (using KDE KDE 3.5.0) OS: Linux PROBLEM: A text view object with the "Auto Resize for Text" property checked does not resize as the user would expect. STEPS TO REPRODUCE: Start Kst Create a text view object and check the "Auto Resize for Text" property Click on the text object to select it Using the lower-left corner of the text object drag the corner left and down to resize it Release the mouse button RESULTS: The text object remains the same size but jumps to the top-left of the rectangle defined by the user's drag operation EXPECTED RESULTS: Either the user is unable to resize this text object or the text object remains at the same location following the operation. My preference would be the former.
Proposed patch for this problem. Index: kstviewlabel.cpp =================================================================== --- kstviewlabel.cpp (revision 503013) +++ kstviewlabel.cpp (working copy) @@ -73,7 +73,7 @@ reparse(); computeTextSize(_parsed); setDirty(false); - _autoResize = true; + setAutoResize(true); } @@ -114,7 +114,7 @@ n = n.nextSibling(); } - _autoResize = in_autoResize; + setAutoResize(in_autoResize); } @@ -491,6 +491,7 @@ void KstViewLabel::setAutoResize(bool on) { _autoResize = on; + _isResizable = !on; }
Untested, but looks good to me. If it works for you, please commit to trunk. On Friday 27 January 2006 16:39, Andrew Walker wrote: [bugs.kde.org quoted mail]
The current behavior is intentional, if surprising. The problem is with the definition of 'text size', which was inherited from the definition for axis labels: size 0 is supposed to mean 12 point for some default size plot (don't remember exactly what size...). If you then make the plot bigger, the label should grow. If you shrink the plot, the labels should get smaller (down to a floor size). Now, what about a label that is the child of a plot, other than axis labels? It would be surprising indeed if their size had a different definition. So, in calculating the size the font should be, we use the dimensions of the parent. If a label of text size '0' is the child of a big plot, the displayed font should be larger than if it is the parent of a small plot. (ie, parented floating labels have the same behavior as axis labels). Of course the label could be owned by things other than a plot, like an ellipse in the bug report. So..... the current behavior, at least, is usable, once understood. So the proposed patch, at least tentativly, is "not accepted=me".
Barth, I think your comment was meant for 120883 and not 120884.
SVN commit 503027 by arwalker: BUG:120884 No longer allow an auto-resize text label to be resized as this is a meaningless operation. M +13 -4 kstviewlabel.cpp --- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #503026:503027 @@ -73,7 +73,7 @@ reparse(); computeTextSize(_parsed); setDirty(false); - _autoResize = true; + setAutoResize(true); } @@ -114,7 +114,7 @@ n = n.nextSibling(); } - _autoResize = in_autoResize; + setAutoResize(in_autoResize); } @@ -331,7 +331,11 @@ if (p.type() == KstPainter::P_PRINT || p.type() == KstPainter::P_EXPORT) { if (_autoResize) { - adjustSizeForText(p.window()); + if (_parent) { + adjustSizeForText(_parent->geometry()); + } else { + adjustSizeForText(p.window()); + } } else { computeTextSize(_parsed); } @@ -350,7 +354,11 @@ } if (dirty()) { if (_autoResize) { - adjustSizeForText(p.window()); + if (_parent) { + adjustSizeForText(_parent->geometry()); + } else { + adjustSizeForText(p.window()); + } drawToBuffer(_parsed); } else { computeTextSize(_parsed); @@ -491,6 +499,7 @@ void KstViewLabel::setAutoResize(bool on) { _autoResize = on; + _isResizable = !on; }