KShare/cropeditor/settings/blurdialog.cpp

44 lines
1.5 KiB
C++
Raw Normal View History

2017-05-01 11:28:54 +02:00
#include "blurdialog.hpp"
#include "ui_blurdialog.h"
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QDoubleSpinBox>
#include <QSlider>
BlurDialog::BlurDialog(QGraphicsBlurEffect *e, QWidget *parent) : QDialog(parent), ui(new Ui::BlurDialog)
{
effect = e;
ui->setupUi(this);
ui->animated->setChecked(effect->blurHints().testFlag(QGraphicsBlurEffect::AnimationHint));
ui->performance->setChecked(effect->blurHints().testFlag(QGraphicsBlurEffect::PerformanceHint));
ui->quality->setChecked(effect->blurHints().testFlag(QGraphicsBlurEffect::QualityHint));
ui->radSlider->setValue(effect->blurRadius() * 100);
ui->radSpinner->setValue(effect->blurRadius());
connect(ui->buttonBox, &QDialogButtonBox::accepted, [&] {
QFlags<QGraphicsBlurEffect::BlurHint> hints;
hints.setFlag(QGraphicsBlurEffect::AnimationHint, ui->animated->isChecked());
hints.setFlag(QGraphicsBlurEffect::PerformanceHint, ui->performance->isChecked());
hints.setFlag(QGraphicsBlurEffect::QualityHint, ui->quality->isChecked());
effect->setBlurHints(hints);
effect->setBlurRadius(ui->radSpinner->value());
close();
});
2017-05-01 18:43:54 +02:00
connect(ui->buttonBox, &QDialogButtonBox::rejected, [&] { close(); });
2017-05-01 11:28:54 +02:00
}
BlurDialog::~BlurDialog()
{
delete ui;
}
void BlurDialog::on_radSpinner_valueChanged(double arg1)
{
ui->radSlider->setValue(arg1 * 100);
}
void BlurDialog::on_radSlider_sliderMoved(int position)
{
ui->radSpinner->setValue(position / 100.);
}