void PlotZoomPropertyWidget::updateFromProperty() { if (! property_->get().empty()) { spXlow_->setValue(property_->top().xZoom_.getLeft()); spXhigh_->setValue(property_->top().xZoom_.getRight()); spYlow_->setValue(property_->top().yZoom_.getLeft()); spYhigh_->setValue(property_->top().yZoom_.getRight()); spZlow_->setValue(property_->top().zZoom_.getLeft()); spZhigh_->setValue(property_->top().zZoom_.getRight()); setSpinBoxRanges(); } if (property_->getShowThirdDimension()) { lblZ_->setVisible(true); spZlow_->setVisible(true); spZhigh_->setVisible(true); } else { lblZ_->setVisible(false); spZlow_->setVisible(false); spZhigh_->setVisible(false); } }
PlotZoomPropertyWidget::PlotZoomPropertyWidget(PlotSelectionProperty* prop, QWidget* parent) : QPropertyWidget(prop, parent) , property_(prop) , lblX_(0) , lblY_(0) , lblZ_(0) , btnPush_(0) , btnPop_(0) , spXlow_(0) , spXhigh_(0) , spYlow_(0) , spYhigh_(0) , spZlow_(0) , spZhigh_(0) { QWidget* mainWidget = new QWidget(this); QGridLayout* gl = new QGridLayout(); lblX_ = new QLabel(tr("x Axis:")); spXlow_ = new QDoubleSpinBox(); spXlow_->setDecimals(4); spXhigh_ = new QDoubleSpinBox(); spXhigh_->setDecimals(4); gl->addWidget(lblX_, 0, 0); gl->addWidget(spXlow_, 0, 1); gl->addWidget(spXhigh_, 0, 2); lblY_ = new QLabel(tr("y Axis:")); spYlow_ = new QDoubleSpinBox(); spYlow_->setDecimals(4); spYhigh_ = new QDoubleSpinBox(); spYhigh_->setDecimals(4); gl->addWidget(lblY_, 1, 0); gl->addWidget(spYlow_, 1, 1); gl->addWidget(spYhigh_, 1, 2); lblZ_ = new QLabel(tr("z Axis:")); spZlow_ = new QDoubleSpinBox(); spZlow_->setDecimals(4); spZhigh_ = new QDoubleSpinBox(); spZhigh_->setDecimals(4); gl->addWidget(lblZ_, 2, 0); gl->addWidget(spZlow_, 2, 1); gl->addWidget(spZhigh_, 2, 2); btnPush_ = new QPushButton(tr("Apply")); btnPop_ = new QPushButton(tr("Undo")); gl->addWidget(btnPush_, 3, 1); gl->addWidget(btnPop_, 3, 2); connect(btnPop_, SIGNAL(clicked()), this, SLOT(btnPopClicked())); connect(btnPush_, SIGNAL(clicked()), this, SLOT(btnPushClicked())); connect(spXlow_, SIGNAL(editingFinished()), this, SLOT(setSpinBoxRanges())); connect(spXhigh_, SIGNAL(editingFinished()), this, SLOT(setSpinBoxRanges())); connect(spYlow_, SIGNAL(editingFinished()), this, SLOT(setSpinBoxRanges())); connect(spYhigh_, SIGNAL(editingFinished()), this, SLOT(setSpinBoxRanges())); updateFromProperty(); mainWidget->setLayout(gl); addWidget(mainWidget); addVisibilityControls(); }