[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Aug 3 22:05:22 CEST 2004


CVS commit by arwalker: 

Fix problems with labels (86118). If the text, size, etc. associated with a label was modified then the width would be explicitly recalculated, else it would be recalculated on every draw operation. With the axes labels the cached Width property of the label would not be set as invalid (-1) so the old Width would be assumed to be valid, which was not true following a resize operation on a plot. We now explicitly invalidate the old label Width. 


  M +3 -1      kst2dplot.cpp   1.195
  M +4 -0      kstlabel.cpp   1.38
  M +2 -1      kstlabel.h   1.25


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.194:1.195
@@ -1174,4 +1173,7 @@ void Kst2DPlot::draw(QPainter &p, KstPai
   /* Draw the axis and labels */
   /* Draw Labels */
+  XLabel->setResized();
+  YLabel->setResized();
+  TopLabel->setResized();
   YLabel->draw(p, (YLabel->lineSpacing(p) - YLabel->ascent(p))/2, y_px/2);
   XLabel->draw(p, x_px/2, y_px-(XLabel->lineSpacing(p) - XLabel->ascent(p))/2);

--- kdeextragear-2/kst/kst/kstlabel.cpp  #1.37:1.38
@@ -77,4 +77,8 @@ KstLabel::~KstLabel(){
 }
 
+void KstLabel::setResized() {
+  Width = -1; // invalidate the width
+}
+
 void KstLabel::setText(const QString &in_text) {
   if (Text != in_text) {

--- kdeextragear-2/kst/kst/kstlabel.h  #1.24:1.25
@@ -48,4 +48,5 @@ public:
   void offsetRelPosition(float offset_x, float offset_y);
   void setJustification(KstJustifyType Justify);
+  void setResized( );
 
   KstJustifyType justification() const {return Justify;}





More information about the Kst mailing list