[Kst] extragear/graphics/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu Aug 18 00:40:39 CEST 2005


SVN commit 450333 by arwalker:

Use new label architecture. Note that the fit label will not present correct information to the user unless the fit is updated prior to generation of the label; an unlikely event.

 M  +10 -9     kstfitdialog_i.cpp  


--- trunk/extragear/graphics/kst/kst/kstfitdialog_i.cpp #450332:450333
@@ -125,14 +125,12 @@
   KstVectorPtr xVector;
   KstVectorPtr yVector;
   KstVectorPtr wVector;
-  KstViewLabel* label;
   KstVCurvePtr fit;
   QString strLabel;
   bool bRetVal = false;
 
-  // Generate new fit name
   QString c_name = KST::suggestCurveName(plugin->tagName(), true);
-
+  
   if (plugin->inputVectors().contains("X Array")) {
     xVector = plugin->inputVectors()["X Array"];
   }
@@ -151,8 +149,7 @@
       fit->Point.setType(_curveAppearance->pointType());
       fit->setBarStyle(_curveAppearance->barStyle());
       fit->setPointDensity(_curveAppearance->pointDensity());
-
-      // create the necessary label
+      
       strLabel = i18n("curvename: pluginname\\n", "%2: %1\\n").
                  arg(_strCurve.replace( '_',  "\\_" ).remove( QRegExp( "^[C][0-9]{1,2}\\-" ) )).
                  arg(plugin->plugin()->data()._readableName);
@@ -181,10 +178,14 @@
       if (w && w->view()->findChild(_strPlotName)) {
         Kst2DPlotPtr plot = kst_cast<Kst2DPlot>(w->view()->findChild(_strPlotName));
         if (plot) {
-          // FIXME: add a KstViewLabel
-          //label = new KstLabel(strLabel, LxTy, 0.0, 0.05, 0.05);
-          //plot->addLabel(label);
-          plot->addCurve(fit.data());
+          KstViewLabelPtr label = new KstViewLabel(strLabel, KST_JUSTIFY_H_LEFT | KST_JUSTIFY_V_TOP, 0.0);
+          label->setTransparent(true);
+          plot->appendChild(KstViewObjectPtr(label), true);
+          label->resizeFromAspect(0.05, 0.05, 0.05, 0.05);
+          label->setAutoResize(true);
+          label->adjustSizeForText();
+          
+          plot->addCurve(KstBaseCurvePtr(fit));
         }
       }
 


More information about the Kst mailing list