5 #include "qui/ZoomWidget.hpp"
9 ZoomWidget::ZoomWidget(QWidget *parent)
11 zoom(new QDoubleSpinBox),
14 zoom->setRange(0.01, max_zoom_size);
15 zoom->setSingleStep(0.1);
16 connect(zoom, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
18 QLabel *zoomLabel = new QLabel();
19 zoomLabel->setPixmap(QIcon(":/icons/viewmag.png").pixmap(16, 16));
20 QHBoxLayout *layout = new QHBoxLayout;
21 layout->addWidget(zoomLabel);
22 layout->addWidget(zoom);
23 layout->addWidget(new QLabel("bp/pix"));
26 setToolTip(tr("Zoom"));
27 setWhatsThis(tr("Zoom magnification factor (base pairs per pixel)"));
30 void ZoomWidget::setValue(double value)
32 if (cur_value != value)
35 zoom->setValue(cur_value);
36 emit valueChanged(cur_value);
40 void ZoomWidget::setRange(double min, double max)
42 zoom->setRange(min, max);
45 void ZoomWidget::setSingleStep(double val)
47 zoom->setSingleStep(val);
50 double ZoomWidget::singleStep() const
52 return zoom->singleStep();
55 double ZoomWidget::minimum() const
57 return zoom->minimum();
60 double ZoomWidget::maximum() const
62 return zoom->maximum();