[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Thu Sep 15 06:54:26 CEST 2005


SVN commit 460758 by staikos:

cleanup the formatting a bit, and fix linestep on KDoubleSpinBox.  That's one
strange class.  It basically doesn't work as documented.


 M  +21 -22    ksteditviewobjectdialog_i.cpp  


--- trunk/extragear/graphics/kst/kst/ksteditviewobjectdialog_i.cpp #460757:460758
@@ -74,16 +74,14 @@
 
 void KstEditViewObjectDialogI::clearWidgets() {
   // clear all the current widgets from the grid
-  while (!_inputWidgets.isEmpty()) {
-    QWidget* tempWidget = _inputWidgets.back();
-    _inputWidgets.pop_back();
-    delete tempWidget;
+  for (QValueList<QWidget*>::Iterator i = _inputWidgets.begin(); i != _inputWidgets.end(); ++i) {
+    delete *i;
   }
-  while (!_widgets.isEmpty()) {
-    QWidget* tempWidget = _widgets.back();
-    _widgets.pop_back();
-    delete tempWidget;
+  _inputWidgets.clear();
+  for (QValueList<QWidget*>::Iterator i = _widgets.begin(); i != _widgets.end(); ++i) {
+    delete *i;
   }
+  _widgets.clear();
   // and the delete the grid itself
   delete _grid;
   _grid = 0L;
@@ -91,7 +89,6 @@
 
 
 void KstEditViewObjectDialogI::updateWidgets() {
-  
   // clear all the current widgets from the grid
   clearWidgets();
   
@@ -114,7 +111,6 @@
       QMap<QString, QVariant> metaData = _viewObject->widgetHints(propertyName);
       
       if (!metaData.empty()) {
-        
         QString friendlyName = metaData["_kst_label"].toString();
         QString widgetType = metaData["_kst_widgetType"].toString();
         metaData.erase("_kst_label");
@@ -124,7 +120,7 @@
         QLabel* propertyLabel = new QLabel(_propertiesFrame, "label-"+i);
         propertyLabel->setText(friendlyName);
         _grid->addWidget(propertyLabel,i,0);
-        _widgets.push_back(propertyLabel);
+        _widgets.append(propertyLabel);
         propertyLabel->show();
         
         // display different types of widgets depending on what dialogData specifies
@@ -159,9 +155,12 @@
           // insert a double num spinbox
           KDoubleSpinBox* input = new KDoubleSpinBox(_propertiesFrame, (propertyName+","+"value").latin1());
           // need this so that setValue later works
-          input->setMinValue(_viewObject->property(property->name()).toDouble());
-          input->setMaxValue(_viewObject->property(property->name()).toDouble());
-          // FIXME: pass this in via meta data input->setLineStep(1.0);
+          input->setMinValue(metaData["minValue"].toDouble());
+          input->setMaxValue(metaData["maxValue"].toDouble());
+          input->setLineStep(metaData["lineStep"].toDouble());
+          metaData.erase("minValue");
+          metaData.erase("maxValue");
+          metaData.erase("lineStep");
           propertyWidget = input; 
           propertyWidget->setProperty("value", _viewObject->property(property->name())); 
         } else if (widgetType == "KFontCombo") {
@@ -183,12 +182,12 @@
         }
         
         // also set any additional properties specified by metaData
-        for (QMap<QString, QVariant>::iterator it = metaData.begin(); it != metaData.end(); ++it) {
+        for (QMap<QString, QVariant>::ConstIterator it = metaData.begin(); it != metaData.end(); ++it) {
           propertyWidget->setProperty(it.key().latin1(), it.data());
         }
         
-        _grid->addWidget(propertyWidget,i,1);
-        _inputWidgets.push_back(propertyWidget);
+        _grid->addWidget(propertyWidget, i, 1);
+        _inputWidgets.append(propertyWidget);
         propertyWidget->show();
       }   
     }
@@ -218,11 +217,11 @@
   widget->clear(); 
   
   QValueList<Qt::PenStyle> styles;
-  styles.push_back(Qt::SolidLine);
-  styles.push_back(Qt::DashLine);
-  styles.push_back(Qt::DotLine);
-  styles.push_back(Qt::DashDotLine);
-  styles.push_back(Qt::DashDotDotLine);
+  styles.append(Qt::SolidLine);
+  styles.append(Qt::DashLine);
+  styles.append(Qt::DotLine);
+  styles.append(Qt::DashDotLine);
+  styles.append(Qt::DashDotDotLine);
   
   while (!styles.isEmpty()) {
     pen.setStyle(styles.front());


More information about the Kst mailing list