summaryrefslogtreecommitdiffhomepage
path: root/spline/spline-widget.cpp
diff options
context:
space:
mode:
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();
}