From: Diane Trout Date: Fri, 27 Oct 2006 23:56:32 +0000 (+0000) Subject: use pointers for zoom spinbox in ZoomWidget X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=c189cafee3b0cd640a44e55d492115235ca59a4a use pointers for zoom spinbox in ZoomWidget --- diff --git a/qui/ZoomWidget.cpp b/qui/ZoomWidget.cpp index 24c71a1..2ceba40 100644 --- a/qui/ZoomWidget.cpp +++ b/qui/ZoomWidget.cpp @@ -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 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(); } diff --git a/qui/ZoomWidget.hpp b/qui/ZoomWidget.hpp index 259e308..f99401e 100644 --- a/qui/ZoomWidget.hpp +++ b/qui/ZoomWidget.hpp @@ -27,7 +27,7 @@ signals: void valueChanged(double); protected: - QDoubleSpinBox zoom; + QDoubleSpinBox *zoom; double cur_value; const double max_zoom_size;