Apparently I lost a } in a Mac OS X specific section of the code. Sowwy. Fixed.
[mussa.git] / qui / ZoomWidget.cpp
index b32efeafda798b9a8e7cbdc5056c5492ddec9e35..f8f856a5d11c7c3877a2d845ab35b7e62c315313 100644 (file)
@@ -8,18 +8,20 @@ using namespace std;
 
 ZoomWidget::ZoomWidget(QWidget *parent)
   : QWidget(parent),
+    zoom(0),
     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 = new QDoubleSpinBox(this);
+  zoom->setRange(0.01, max_zoom_size);
+  zoom->setSingleStep(0.1);
+  connect(zoom, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
 
   QLabel *zoomLabel = new QLabel();
   zoomLabel->setPixmap(QIcon(":/icons/viewmag.png").pixmap(16, 16));
   QHBoxLayout *layout = new QHBoxLayout;
   layout->addWidget(zoomLabel);
-  layout->addWidget(&zoom);
-  layout->addWidget(new QLabel("bp/pix"));
+  layout->addWidget(zoom);
+  layout->addWidget(new QLabel("bp/pix", this));
   setLayout(layout);
 
   setToolTip(tr("Zoom"));
@@ -31,33 +33,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();
 }