[Kst] extragear/graphics/kst/src

Duncan Hanson duncan.hanson at gmail.com
Mon May 15 18:25:25 CEST 2006


SVN commit 541132 by dhanson:

BUG:124986 this should cover all of the ways a curve's legend entry can be modified.

 M  +5 -0      libkstapp/kstviewlegend.cpp  
 M  +1 -0      libkstapp/kstviewlegend.h  
 M  +7 -0      libkstmath/kstbasecurve.cpp  
 M  +6 -2      libkstmath/kstbasecurve.h  
 M  +8 -0      libkstmath/kstvcurve.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlegend.cpp #541131:541132
@@ -485,6 +485,9 @@
   setContentsRect(cr);
 }
 
+void KstViewLegend::modifiedLegendEntry() {
+  setDirty();
+}
 
 bool KstViewLegend::layoutPopupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topLevelParent) {
   return KstViewObject::layoutPopupMenu(menu, pos, topLevelParent);
@@ -524,6 +527,7 @@
 void KstViewLegend::addCurve(KstBaseCurvePtr incurve) {
   if (!_curves.contains(incurve)) {
     _curves.append(incurve);
+    connect(incurve, SIGNAL(modifiedLegendEntry()), this, SLOT(modifiedLegendEntry()));
     setDirty();
   }
 }
@@ -532,6 +536,7 @@
 void KstViewLegend::removeCurve(KstBaseCurvePtr incurve) {
   if (_curves.contains(incurve)) {
     _curves.remove(incurve);
+    disconnect(incurve,SIGNAL(modifiedLegendEntry()), this, SLOT(modifiedLegendEntry()));
     setDirty();
   }
 }
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlegend.h #541131:541132
@@ -93,6 +93,7 @@
 
   public slots:
     void adjustSizeForText(QRect w);
+    void modifiedLegendEntry(void);
 
   protected:
     KstViewObjectFactoryMethod factory() const;
--- trunk/extragear/graphics/kst/src/libkstmath/kstbasecurve.cpp #541131:541132
@@ -68,4 +68,11 @@
   }
   return _parsedLegendTag;
 }
+
+void KstBaseCurve::setLegendText(const QString& theValue) { 
+  _legendText = theValue; 
+  updateParsedLegendTag(); 
+  emit modifiedLegendEntry();
+}
+
 // vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/src/libkstmath/kstbasecurve.h #541131:541132
@@ -46,6 +46,8 @@
 enum KstCurveType { KST_VCURVE, KST_HISTOGRAM, KST_IMAGE };
 
 class KST_EXPORT KstBaseCurve : public KstDataObject {
+  Q_OBJECT
+
   public:
     KstBaseCurve();
     KstBaseCurve(const QDomElement& e);
@@ -112,7 +114,7 @@
     virtual Label::Parsed *parsedLegendTag();
     virtual void updateParsedLegendTag();
     
-    void setLegendText(const QString& theValue) { _legendText = theValue; updateParsedLegendTag(); }
+    void setLegendText(const QString& theValue);
     QString legendText() const { return _legendText;}
 
   protected:
@@ -138,8 +140,10 @@
 
   private:
     void commonConstructor();
-private:
     QString _legendText;
+
+  signals: 
+    void modifiedLegendEntry(void);
 };
 
 
--- trunk/extragear/graphics/kst/src/libkstmath/kstvcurve.cpp #541131:541132
@@ -739,48 +739,56 @@
 void KstVCurve::setHasPoints(bool in_HasPoints) {
   HasPoints = in_HasPoints;
   setDirty();
+  emit modifiedLegendEntry();
 }
 
 
 void KstVCurve::setHasLines(bool in_HasLines) {
   HasLines = in_HasLines;
   setDirty();
+  emit modifiedLegendEntry();
 }
 
 
 void KstVCurve::setHasBars(bool in_HasBars) {
   HasBars = in_HasBars;
   setDirty();
+  emit modifiedLegendEntry();
 }
 
 
 void KstVCurve::setLineWidth(int in_LineWidth) {
   LineWidth = in_LineWidth;
   setDirty();
+  emit modifiedLegendEntry();
 }
 
 
 void KstVCurve::setLineStyle(int in_LineStyle) {
   LineStyle = in_LineStyle;
   setDirty();
+  emit modifiedLegendEntry();
 }
 
 
 void KstVCurve::setBarStyle(int in_BarStyle) {
   BarStyle = in_BarStyle;
   setDirty();
+  emit modifiedLegendEntry();
 }
 
 
 void KstVCurve::setPointDensity(int in_PointDensity) {
   PointDensity = in_PointDensity;
   setDirty();
+  emit modifiedLegendEntry();
 }
 
 
 void KstVCurve::setColor(const QColor& new_c) {
   setDirty();
   Color = new_c;
+  emit modifiedLegendEntry();
 }
 
 


More information about the Kst mailing list