Tue, 17 Mar 2020 23:13:47 +0200
added doublespinbox
#include "multiplyfactordialog.h" #include "ui_multiplyfactordialog.h" MultiplyFactorDialog::MultiplyFactorDialog(const glm::vec3& baseVector, QWidget* parent) : QDialog{parent}, baseVector{baseVector}, preview{baseVector, parent, Vec3Editor::NoMultiplyButton} { ui = std::make_unique<Ui::MultiplyFactorDialog>(); ui->setupUi(this); this->preview.setEnabled(false); this->ui->previewGroupBox->setLayout(new QVBoxLayout{parent}); this->ui->previewGroupBox->layout()->addWidget(&this->preview); connect(this->ui->invert, &QCheckBox::clicked, this, &MultiplyFactorDialog::updatePreview); connect(this->ui->factor, qOverload<double>(&DoubleSpinBox::valueChanged), this, &MultiplyFactorDialog::updatePreview); } MultiplyFactorDialog::~MultiplyFactorDialog() { } glm::vec3 MultiplyFactorDialog::value() const { glm::vec3 result = baseVector; if (this->ui->invert->isChecked()) { result /= this->ui->factor->value(); } else { result *= this->ui->factor->value(); } return result; } void MultiplyFactorDialog::updatePreview() { this->preview.setValue(this->value()); }