change from slider to spinner for threshold
authorDiane Trout <diane@caltech.edu>
Thu, 23 Mar 2006 18:33:40 +0000 (18:33 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 23 Mar 2006 18:33:40 +0000 (18:33 +0000)
Use a spinner instead of a slider as its useful to be able to type in a
threshold. (starts implementation of ticket:39)
Also ticket:55 would be _very_ helpful.

qui/MussaWindow.cpp
qui/ThresholdWidget.cpp
qui/ThresholdWidget.hpp

index 01b13ea974f565bd658310141fab049754f865ab..b84da1df21b0225fb9434f45842e94cfeb890e61 100644 (file)
@@ -54,9 +54,9 @@ MussaWindow::MussaWindow(Mussa *analysis_, QWidget *parent) :
   mussaViewTB.addWidget(&zoomBox);
   connect(&zoomBox, SIGNAL(valueChanged(int)), 
           &browser, SLOT(setZoom(int)));
-  
-  threshold.setRange(19, 30);
-  threshold.setThreshold(19);
+  threshold.setRange(10,30);
+  threshold.setThreshold(20);
   //scene->setClipPlane(20);
   // FIXME: for when we get the paths drawn at the appropriate depth
   //connect(&threshold, SIGNAL(thresholdChanged(int)),
index 5837b4b34ce0161b16be799da4ae4e1f476e4d99..a97f502938912e60e76228f4a5ecb034d45e9d6c 100644 (file)
@@ -9,67 +9,60 @@
 ThresholdWidget::ThresholdWidget(QWidget *parent, int min, int max) 
   : QWidget(parent)
 {
-  QLCDNumber *lcd = new QLCDNumber(threshold_max_display_digits);
-  lcd->setSegmentStyle(QLCDNumber::Flat);
+  basepair_spinner.setRange(min, max);
 
-  slider = new QSlider(Qt::Horizontal);
-  slider->setRange(min, max);
-
-  connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));
-  connect(slider, SIGNAL(valueChanged(int)), 
+  connect(&basepair_spinner, SIGNAL(valueChanged(int)), 
           this, SIGNAL(thresholdChanged(int)));
 
-  slider->setValue(min);
-  lcd->display(min);
+  basepair_spinner.setValue(min);
 
   QHBoxLayout *layout = new QHBoxLayout;
-  layout->addWidget(slider);
-  layout->addWidget(lcd);
+  layout->addWidget(&basepair_spinner);
   setLayout(layout);
 }
 /*
 void ThresholdWidget::setMinimumThreshold(int min)
 {
-  slider->setMinimum(min);
+  basepair_spinner->setMinimum(min);
 }
 
 int ThresholdWidget::getMinimumThreshold()
 {
-  return slider->minimum();
+  return basepair_spinner->minimum();
 }
 
 void ThresholdWidget::setMaximumThreshold(int max)
 {
-  slider->setMaximum(max);
+  basepair_spinner->setMaximum(max);
 }
 
 int ThresholdWidget::getMaximumThreshold()
 {
-  return slider->maximum();
+  return basepair_spinner->maximum();
 }
 */
 void ThresholdWidget::setRange(int min, int max)
 {
-  slider->setRange(min, max);
+  basepair_spinner.setRange(min, max);
 }
 
 float ThresholdWidget::percent() const
 {
-  return ((float)threshold())/((float)slider->maximum()); 
+  return ((float)threshold())/((float)basepair_spinner.maximum()); 
 }
 
 void ThresholdWidget::setThreshold(int threshold)
 {
-  if (slider->value() != threshold)
+  if (basepair_spinner.value() != threshold)
   {
-    slider->setValue(threshold);
+    basepair_spinner.setValue(threshold);
     emit thresholdChanged(threshold);
   }
 }
 
 int ThresholdWidget::threshold() const
 {
-  return slider->value();
+  return basepair_spinner.value();
 }
 
 
index 320858fef9decae361a127309ac41f8a378a26df..eed7ee812adf2fe12f279785ccb0597730b07461 100644 (file)
@@ -1,10 +1,9 @@
 #ifndef _THRESHOLD_WIDGET_H_ 
 #define _THRESHOLD_WIDGET_H_
 
+#include <QSpinBox>
 #include <QWidget>
 
-class QSlider;
-
 class ThresholdWidget : public QWidget
 {
   Q_OBJECT 
@@ -25,7 +24,7 @@ signals:
   void thresholdChanged(int new_threshold);
 
 protected:
-  QSlider *slider;
+  QSpinBox basepair_spinner;
 
 };
 const int threshold_max_display_digits = 2;