[Kst] branches/work/kst/portto4/kst/src/libkstapp

Mike Fenton mike at staikos.net
Fri Jul 11 21:49:55 CEST 2008


SVN commit 831081 by fenton:

Update DataWizard to support Labels / Legend.
Fix crash in Datawizard.


 M  +27 -28    datawizard.cpp  
 M  +0 -1      datawizard.h  
 M  +35 -45    datawizardpageplot.ui  


--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #831080:831081
@@ -327,11 +327,6 @@
 }
 
 
-bool DataWizardPagePlot::plotTitles() const {
-  return _plotTitles->isChecked();
-}
-
-
 bool DataWizardPagePlot::legendsOn() const {
   return _legendsOn->isChecked();
 }
@@ -829,23 +824,24 @@
 
         Q_ASSERT(_document && _document->objectStore());
         powerspectrum = _document->objectStore()->createObject<PSD>();
-	n_psd++;
+        n_psd++;
         Q_ASSERT(powerspectrum);
 
         powerspectrum->writeLock();
-        powerspectrum->setVector(*it);
-        powerspectrum->setFrequency(_pageDataPresentation->getFFTOptions()->sampleRate());
-        powerspectrum->setAverage(_pageDataPresentation->getFFTOptions()->interleavedAverage());
-        powerspectrum->setLength(_pageDataPresentation->getFFTOptions()->FFTLength());
-        powerspectrum->setApodize(_pageDataPresentation->getFFTOptions()->apodize());
-        powerspectrum->setRemoveMean(_pageDataPresentation->getFFTOptions()->removeMean());
-        powerspectrum->setVectorUnits(_pageDataPresentation->getFFTOptions()->vectorUnits());
-        powerspectrum->setRateUnits(_pageDataPresentation->getFFTOptions()->rateUnits());
-        powerspectrum->setApodizeFxn(_pageDataPresentation->getFFTOptions()->apodizeFunction());
-        powerspectrum->setGaussianSigma(_pageDataPresentation->getFFTOptions()->sigma());
-        powerspectrum->setOutput(_pageDataPresentation->getFFTOptions()->output());
-        powerspectrum->setInterpolateHoles(_pageDataPresentation->getFFTOptions()->interpolateOverHoles());
 
+        powerspectrum->change(*it,
+                              _pageDataPresentation->getFFTOptions()->sampleRate(), 
+                              _pageDataPresentation->getFFTOptions()->interleavedAverage(),
+                              _pageDataPresentation->getFFTOptions()->FFTLength(),
+                              _pageDataPresentation->getFFTOptions()->apodize(),
+                              _pageDataPresentation->getFFTOptions()->removeMean(),
+                              _pageDataPresentation->getFFTOptions()->vectorUnits(),
+                              _pageDataPresentation->getFFTOptions()->rateUnits(),
+                              _pageDataPresentation->getFFTOptions()->apodizeFunction(),
+                              _pageDataPresentation->getFFTOptions()->sigma(),
+                              _pageDataPresentation->getFFTOptions()->output(),
+                              _pageDataPresentation->getFFTOptions()->interpolateOverHoles());
+
         powerspectrum->update();
         powerspectrum->unlock();
 
@@ -898,9 +894,8 @@
   }
 
   // legends and labels
-  bool xl = _pagePlot->xAxisLabels();
-  bool yl = _pagePlot->yAxisLabels();
-  bool tl = _pagePlot->plotTitles();
+  bool xLabels = _pagePlot->xAxisLabels();
+  bool yLabels = _pagePlot->yAxisLabels();
 
   plotIterator = plotList.begin();
   while (plotIterator != plotList.end()) {
@@ -910,16 +905,20 @@
       continue;
     }
 
-//    FIXME  How do we turn on labels?
-//    plotItem->generateDefaultLabels(xl, yl, tl);
+    if (!xLabels) {
+      plotItem->setLeftLabelOverride(QString(" "));
+      plotItem->setRightLabelOverride(QString(" "));
+    }
+    if (!yLabels) {
+      plotItem->setBottomLabelOverride(QString(" "));
+      plotItem->setTopLabelOverride(QString(" "));
+    }
 
     if (_pagePlot->legendsOn()) {
-//      FIXME
-//      pp->getOrCreateLegend();
+      plotItem->setShowLegend(true);
     } else if (_pagePlot->legendsAuto()) {
-      if (plotItem->renderItems().count() > 1) {
-//        FIXME
-//        pp->getOrCreateLegend();
+      if (plotItem->renderItem(PlotRenderItem::Cartesian)->relationList().count() > 1) {
+        plotItem->setShowLegend(true);
       }
     }
     ++plotIterator;
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.h #831080:831081
@@ -109,7 +109,6 @@
 
     bool xAxisLabels() const;
     bool yAxisLabels() const;
-    bool plotTitles() const;
 
     bool legendsOn() const;
     bool legendsAuto() const;
--- branches/work/kst/portto4/kst/src/libkstapp/datawizardpageplot.ui #831080:831081
@@ -143,24 +143,24 @@
        </layout>
       </item>
       <item row="5" column="0" >
-        <widget class="QCheckBox" name="_createLayout" >
-          <property name="text" >
-            <string>Create Layout if Necessary</string>
-          </property>
-          <property name="checked" >
-            <bool>true</bool>
-          </property>
-        </widget>
+       <widget class="QCheckBox" name="_createLayout" >
+        <property name="text" >
+         <string>Create Layout if Necessary</string>
+        </property>
+        <property name="checked" >
+         <bool>true</bool>
+        </property>
+       </widget>
       </item>
       <item row="6" column="0" >
-        <widget class="QCheckBox" name="_appendToLayout" >
-          <property name="text" >
-            <string>Append if existing Layout</string>
-          </property>
-          <property name="checked" >
-            <bool>true</bool>
-          </property>
-        </widget>
+       <widget class="QCheckBox" name="_appendToLayout" >
+        <property name="text" >
+         <string>Append if existing Layout</string>
+        </property>
+        <property name="checked" >
+         <bool>true</bool>
+        </property>
+       </widget>
       </item>
      </layout>
     </widget>
@@ -252,16 +252,6 @@
        </widget>
       </item>
       <item>
-       <widget class="QCheckBox" name="_plotTitles" >
-        <property name="text" >
-         <string>&amp;Title labels</string>
-        </property>
-        <property name="checked" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
        <layout class="QHBoxLayout" >
         <property name="leftMargin" >
          <number>0</number>
@@ -384,15 +374,15 @@
  <layoutdefault spacing="6" margin="11" />
  <customwidgets>
   <customwidget>
-   <class>QWizardPage</class>
-   <extends>QWidget</extends>
-   <header>qwizardpage.h</header>
-  </customwidget>
-  <customwidget>
    <class>Kst::ComboBox</class>
    <extends>QComboBox</extends>
    <header>combobox.h</header>
   </customwidget>
+  <customwidget>
+   <class>QWizardPage</class>
+   <extends>QWidget</extends>
+   <header>qwizardpage.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections>
@@ -413,20 +403,20 @@
    </hints>
   </connection>
   <connection>
-    <sender>_existingPlot</sender>
-    <signal>toggled(bool)</signal>
-    <receiver>_existingPlotName</receiver>
-    <slot>setEnabled(bool)</slot>
-    <hints>
-      <hint type="sourcelabel" >
-        <x>20</x>
-        <y>20</y>
-      </hint>
-      <hint type="destinationlabel" >
-        <x>20</x>
-        <y>20</y>
-      </hint>
-    </hints>
+   <sender>_existingPlot</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>_existingPlotName</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
   </connection>
  </connections>
 </ui>


More information about the Kst mailing list