[Kst] branches/work/kst/1.5/kst/src

Duncan Hanson duncan.hanson at gmail.com
Thu May 17 00:23:09 CEST 2007


SVN commit 665431 by dhanson:

CCBUG:86915 if the vectorview scalars are removed from the global list, we place their current values into the scalar selector combobox.

 M  +37 -4     libkstapp/kstvvdialog_i.cpp  
 M  +6 -1      widgets/scalarselector.ui.h  


--- branches/work/kst/1.5/kst/src/libkstapp/kstvvdialog_i.cpp #665430:665431
@@ -137,11 +137,44 @@
   _w->_yMinCheckbox->setChecked(vp->useYmin());
   _w->_yMaxCheckbox->setChecked(vp->useYmax());
 
-  if (vp->xMinScalar()) { _w->_xMinScalar->setSelection(vp->xMinScalar()->tag().displayString()); }
-  if (vp->xMaxScalar()) { _w->_xMaxScalar->setSelection(vp->xMaxScalar()->tag().displayString()); }
-  if (vp->yMinScalar()) { _w->_yMinScalar->setSelection(vp->yMinScalar()->tag().displayString()); }
-  if (vp->yMaxScalar()) { _w->_yMaxScalar->setSelection(vp->yMaxScalar()->tag().displayString()); }
+  KstScalarPtr sc;
 
+  sc = vp->xMinScalar();
+  if (!sc) {
+    _w->_xMinScalar->setSelection("0");
+  } else if (*KST::scalarList.findTag(sc->tag().displayString())) {
+    _w->_xMinScalar->setSelection(sc->tag().displayString());
+  } else {
+    _w->_xMinScalar->setSelection(QString::number(sc->value())); //our scalar has been removed from the global list... just put its current value into the scalar selector. warning: after edit it won't be updated anymore! the motivation for putting this in is to not lose scale information when a plot is deleted.
+  }
+
+  sc = vp->xMaxScalar();
+  if (!sc) {
+    _w->_xMaxScalar->setSelection("0");
+  } else if (*KST::scalarList.findTag(sc->tag().displayString())) {
+    _w->_xMaxScalar->setSelection(sc->tag().displayString());
+  } else {
+    _w->_xMaxScalar->setSelection(QString::number(sc->value()));
+  }
+
+  sc = vp->yMinScalar();
+  if (!sc) {
+    _w->_yMinScalar->setSelection("0");
+  } else if (*KST::scalarList.findTag(sc->tag().displayString())) {
+    _w->_yMinScalar->setSelection(sc->tag().displayString());
+  } else {
+    _w->_yMinScalar->setSelection(QString::number(sc->value()));
+  }
+
+  sc = vp->yMaxScalar();
+  if (!sc) {
+    _w->_yMaxScalar->setSelection("0");
+  } else if (*KST::scalarList.findTag(sc->tag().displayString())) {
+    _w->_yMaxScalar->setSelection(sc->tag().displayString());
+  } else {
+    _w->_yMaxScalar->setSelection(QString::number(sc->value()));
+  }
+
   vp->unlock();
   updateButtons();
 
--- branches/work/kst/1.5/kst/src/widgets/scalarselector.ui.h #665430:665431
@@ -56,7 +56,12 @@
     
     qHeapSort(scalars);
     _scalar->insertStringList(scalars);
-    if (found) {
+
+    bool ok;
+    prev.toDouble(&ok);
+    ok = ok && _scalar->editable(); //if directentry is allowed, and if prev is a number, then we can put it back into the combobox.
+
+    if (found || ok) {
         _scalar->setCurrentText(prev);
     } else {
         _scalar->insertItem("0");


More information about the Kst mailing list