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

Barth Netterfield netterfield at astro.utoronto.ca
Thu Nov 20 22:47:35 CET 2008


SVN commit 887029 by netterfield:

More upgrades to the data wizard.



 M  +4 -0      images/images.qrc  
 M  +25 -25    libkstapp/datawizard.cpp  
 M  +50 -1     libkstapp/datawizardpageplot.ui  
 M  +17 -1     libkstapp/datawizardpagevectors.ui  


--- branches/work/kst/portto4/kst/src/images/images.qrc #887028:887029
@@ -67,5 +67,9 @@
         <file>kst_pause.png</file>
         <file>kst_back.png</file>
         <file>kst_forward.png</file>
+        <file>kst_rightarrow.png</file>
+        <file>kst_leftarrow.png</file>
+        <file>kst_uparrow.png</file>
+        <file>kst_downarrow.png</file>
     </qresource>
 </RCC>
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #887028:887029
@@ -100,15 +100,10 @@
   : QWizardPage(parent) {
    setupUi(this);
 
-// TODO Icons required.
-//  _up->setIcon(QPixmap(":kst_uparrow.png"));
-  _up->setText("Up");
-//  _down->setIcon(QPixmap(":kst_downarrow.png"));
-  _down->setText("Down");
-//  _add->setIcon(QPixmap(":kst_rightarrow.png"));
-  _add->setText("Add");
-//  _remove->setIcon(QPixmap(":kst_leftarrow.png"));
-  _remove->setText("Remove");
+  _up->setIcon(QPixmap(":kst_uparrow.png"));
+  _down->setIcon(QPixmap(":kst_downarrow.png"));
+  _add->setIcon(QPixmap(":kst_rightarrow.png"));
+  _remove->setIcon(QPixmap(":kst_leftarrow.png"));
   _up->setToolTip(i18n("Raise in plot order: Alt+Up"));
   _down->setToolTip(i18n("Lower in plot order: Alt+Down"));
   _add->setToolTip(i18n("Select: Alt+s"));
@@ -125,6 +120,7 @@
 
   _vectors->setSortingEnabled(false);
   _vectorsToPlot->setSortingEnabled(false);
+
 }
 
 
@@ -156,18 +152,19 @@
 
 
 void DataWizardPageVectors::remove() {
+  int j=0;
   for (int i = 0; i < _vectorsToPlot->count(); i++) {
     if (_vectorsToPlot->item(i) && _vectorsToPlot->item(i)->isSelected()) {
       _vectors->addItem(_vectorsToPlot->takeItem(i));
-      _vectors->clearSelection();
-      _vectors->item(_vectors->count() - 1)->setSelected(true);
+      j = i;
     }
   }
-
+  if (j>=_vectorsToPlot->count()) {
+    j = _vectorsToPlot->count()-1;
+  }
   _vectorsToPlot->setFocus();
-  if (_vectorsToPlot->currentItem()) {
-    _vectorsToPlot->currentItem()->setSelected(true);
-  }
+  _vectorsToPlot->setCurrentRow(j);
+  _vectors->clearSelection();
 
   emit completeChanged();
 }
@@ -177,12 +174,12 @@
   for (int i = 0; i < _vectors->count(); i++) {
     if (_vectors->item(i) && _vectors->item(i)->isSelected()) {
       _vectorsToPlot->addItem(_vectors->takeItem(i));
-      _vectorsToPlot->clearSelection();
-      _vectorsToPlot->item(_vectorsToPlot->count() - 1)->setSelected(true);
       i--;
     }
   }
 
+  _vectorsToPlot->setCurrentRow(_vectorsToPlot->count() - 1);
+
   _vectors->setFocus();
 
   emit completeChanged();
@@ -190,12 +187,14 @@
 
 
 void DataWizardPageVectors::up() {
+  _vectorsToPlot->setFocus();
+
   int i = _vectorsToPlot->currentRow();
   if (i != -1) {
     QListWidgetItem *item = _vectorsToPlot->takeItem(i);
     _vectorsToPlot->insertItem(i-1, item);
     _vectorsToPlot->clearSelection();
-    item->setSelected(true);
+    _vectorsToPlot->setCurrentItem(item);
     emit completeChanged();
   }
 }
@@ -208,8 +207,7 @@
     QListWidgetItem *item = _vectorsToPlot->takeItem(i);
     _vectorsToPlot->insertItem(i+1, item);
     _vectorsToPlot->clearSelection();
-    item->setSelected(true);
-
+    _vectorsToPlot->setCurrentItem(item);
     emit completeChanged();
   }
 }
@@ -218,17 +216,19 @@
 void DataWizardPageVectors::filterVectors(const QString& filter) {
   _vectors->clearSelection();
   QRegExp re(filter, Qt::CaseSensitive, QRegExp::Wildcard);
-  int j=0;
-  // FIXME: n^2.
+  QStringList selected;
   for (int i = 0; i < _vectors->count(); i++) {
     QListWidgetItem *item = _vectors->item(i);
     if (re.exactMatch(item->text())) {
       item = _vectors->takeItem(i);
-      _vectors->insertItem(j, item);
-      j++;
-      item->setSelected(true);
+      selected.append(item->text());
+      i--;
     }
   }
+  _vectors->insertItems(0, selected);
+  for (int i=0; i<selected.count(); i++) {
+    _vectors->item(i)->setSelected(true);
+  }
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/datawizardpageplot.ui #887028:887029
@@ -331,5 +331,54 @@
   </customwidget>
  </customwidgets>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>_cycleThrough</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>_plotNumber</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>650</x>
+     <y>118</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>735</x>
+     <y>106</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>_customGrid</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>_gridColumns</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>630</x>
+     <y>303</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>831</x>
+     <y>304</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>_existingPlot</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>_existingPlotName</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>683</x>
+     <y>185</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>776</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>
--- branches/work/kst/portto4/kst/src/libkstapp/datawizardpagevectors.ui #887028:887029
@@ -5,7 +5,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>805</width>
+    <width>779</width>
     <height>313</height>
    </rect>
   </property>
@@ -83,6 +83,9 @@
        <property name="text" >
         <string/>
        </property>
+       <property name="shortcut" >
+        <string>Alt+S</string>
+       </property>
       </widget>
      </item>
      <item row="2" column="0" >
@@ -99,6 +102,9 @@
        <property name="text" >
         <string/>
        </property>
+       <property name="shortcut" >
+        <string>Alt+R</string>
+       </property>
       </widget>
      </item>
     </layout>
@@ -205,6 +211,16 @@
   </layout>
  </widget>
  <layoutdefault spacing="6" margin="11" />
+ <tabstops>
+  <tabstop>_vectorReduction</tabstop>
+  <tabstop>_vectors</tabstop>
+  <tabstop>_vectorsToPlot</tabstop>
+  <tabstop>_add</tabstop>
+  <tabstop>_remove</tabstop>
+  <tabstop>_up</tabstop>
+  <tabstop>_down</tabstop>
+  <tabstop>_vectorSearch</tabstop>
+ </tabstops>
  <resources/>
  <connections/>
 </ui>


More information about the Kst mailing list