summaryrefslogtreecommitdiffhomepage
path: root/spline/spline-widget.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-10-20 05:36:40 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-10-20 05:36:40 +0200
commit18b559ff13898e8e96275b7e329bfa23b7394f6f (patch)
tree5d22b7453992a96142c2e6a5e91289e50a377858 /spline/spline-widget.cpp
parentd1e7df336ce101a0fd9b05e4d3b2b8d49f6caa61 (diff)
spline: allow switch pitch mapping max Y 90/180
Diffstat (limited to 'spline/spline-widget.cpp')
-rw-r--r--spline/spline-widget.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp
index a80e08b7..2aa5e6ac 100644
--- a/spline/spline-widget.cpp
+++ b/spline/spline-widget.cpp
@@ -49,25 +49,23 @@ spline_widget::~spline_widget()
void spline_widget::setConfig(spline* spl)
{
- if (spl != _config)
+ if (connection)
{
- if (connection)
- {
- QObject::disconnect(connection);
- connection = QMetaObject::Connection();
- }
+ QObject::disconnect(connection);
+ connection = QMetaObject::Connection();
+ }
- if (spl)
- {
- std::shared_ptr<spline::settings> s = spl->get_settings();
- connection = connect(s.get(), &spline::settings::recomputed,
- this, [this]() { reload_spline(); },
- Qt::QueuedConnection);
- }
+ _config = spl;
- _config = spl;
- _background = QPixmap();
+ if (spl)
+ {
update_range();
+ _config->ensure_valid(_config->get_points());
+
+ std::shared_ptr<spline::settings> s = spl->get_settings();
+ connection = connect(s.get(), &spline::settings::recomputed,
+ this, [this]() { reload_spline(); },
+ Qt::QueuedConnection);
}
}
@@ -509,6 +507,8 @@ void spline_widget::mouseReleaseEvent(QMouseEvent *e)
void spline_widget::reload_spline()
{
+ if (_config)
+ _config->ensure_valid(_config->get_points());
// don't recompute here as the value's about to be recomputed in the callee
update_range();
}