use pointers for zoom spinbox in ZoomWidget
authorDiane Trout <diane@caltech.edu>
Fri, 27 Oct 2006 23:56:32 +0000 (23:56 +0000)
committerDiane Trout <diane@caltech.edu>
Fri, 27 Oct 2006 23:56:32 +0000 (23:56 +0000)
qui/ZoomWidget.cpp
qui/ZoomWidget.hpp

index 24c71a1de06cb161bc15c8e9e712c64f255036e3..2ceba408081440039b340024845edc229eb811d0 100644 (file)
@@ -8,17 +8,18 @@ using namespace std;
 
 ZoomWidget::ZoomWidget(QWidget *parent)
   : QWidget(parent),
+    zoom(new QDoubleSpinBox),
     max_zoom_size(10000)
 {
-  zoom.setRange(0.01, max_zoom_size);
-  zoom.setSingleStep(0.1);
-  connect(&zoom, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
+  zoom->setRange(0.01, max_zoom_size);
+  zoom->setSingleStep(0.1);
+  connect(zoom, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
 
-  auto_ptr<QLabel> zoomLabel(new QLabel());
+  QLabel *zoomLabel = new QLabel();
   zoomLabel->setPixmap(QIcon(":/icons/viewmag.png").pixmap(16, 16));
   QHBoxLayout *layout = new QHBoxLayout;
-  layout->addWidget(zoomLabel.get());
-  layout->addWidget(&zoom);
+  layout->addWidget(zoomLabel);
+  layout->addWidget(zoom);
   layout->addWidget(new QLabel("bp/pix"));
   setLayout(layout);
 
@@ -31,33 +32,33 @@ void ZoomWidget::setValue(double value)
   if (cur_value != value)
   {
     cur_value = value;
-    zoom.setValue(cur_value);
+    zoom->setValue(cur_value);
     emit valueChanged(cur_value);
   }
 }
 
 void ZoomWidget::setRange(double min, double max)
 {
-  zoom.setRange(min, max);
+  zoom->setRange(min, max);
 }
 
 void ZoomWidget::setSingleStep(double val)
 {
-  zoom.setSingleStep(val);
+  zoom->setSingleStep(val);
 }
 
 double ZoomWidget::singleStep() const
 {
-  return zoom.singleStep();
+  return zoom->singleStep();
 }
 
 double ZoomWidget::minimum() const
 {
-  return zoom.minimum();
+  return zoom->minimum();
 }
 
 double ZoomWidget::maximum() const
 {
-  return zoom.maximum();
+  return zoom->maximum();
 }
 
index 259e308d25d25612f11a404f72edb5ad205baeb3..f99401e548b6a83686fb5ff1fd9cbd7c3c20123e 100644 (file)
@@ -27,7 +27,7 @@ signals:
   void valueChanged(double);
 
 protected:
-  QDoubleSpinBox zoom;
+  QDoubleSpinBox *zoom;
 
   double cur_value;
   const double max_zoom_size;