diff options
Diffstat (limited to 'spline/spline-widget.hpp')
-rw-r--r-- | spline/spline-widget.hpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spline/spline-widget.hpp b/spline/spline-widget.hpp index a6d0eb9d..b0a76e2d 100644 --- a/spline/spline-widget.hpp +++ b/spline/spline-widget.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016 Stanislaw Halik <sthalik@misaki.pl> +/* Copyright (c) 2012-2019 Stanislaw Halik <sthalik@misaki.pl> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -34,12 +34,11 @@ class OTR_SPLINE_EXPORT spline_widget final : public QWidget Q_PROPERTY(int x_step READ x_step WRITE set_x_step) Q_PROPERTY(int y_step READ y_step WRITE set_y_step) - using points_t = base_spline::points_t; public: explicit spline_widget(QWidget *parent = nullptr); ~spline_widget() override; - void setConfig(base_spline* spl); + void set_config(base_spline* spl); QColor colorBezier() const; void setColorBezier(QColor const& color); @@ -48,10 +47,10 @@ public: void set_preview_only(bool val); bool is_preview_only() const; - double x_step() const { return _x_step; } - double y_step() const { return _y_step; } - void set_x_step(double val) { _x_step = std::fmax(1., val); } - void set_y_step(double val) { _y_step = std::fmax(1., val); } + double x_step() const { return x_step_; } + double y_step() const { return y_step_; } + void set_x_step(double val) { x_step_ = std::fmax(1., val); } + void set_y_step(double val) { y_step_ = std::fmax(1., val); } void set_snap(double x, double y) { snap_x = x; snap_y = y; } void get_snap(double& x, double& y) const { x = snap_x; y = snap_y; } @@ -78,6 +77,7 @@ private: bool is_on_pt(const QPointF& pos, int* pt = nullptr); void update_range(); + void changeEvent(QEvent* e) override; QPointF pixel_to_point(const QPointF& point); QPointF point_to_pixel(const QPointF& point); @@ -85,10 +85,10 @@ private: static double snap(double x, double snap_value); QPointF c; - base_spline* _config = nullptr; + base_spline* config = nullptr; - QPixmap _background; - QPixmap _function; + QPixmap background_img; + QPixmap spline_img; QColor spline_color; QColor widget_bg_color = palette().background().color(); @@ -98,12 +98,12 @@ private: QMetaObject::Connection connection; double snap_x = 0, snap_y = 0; - double _x_step = 10, _y_step = 10; + double x_step_ = 10, y_step_ = 10; int moving_control_point_idx = -1; - bool _draw_function = true, _preview_only = false; + bool draw_function = true, preview_only = false; // point's circle radius on the widget - static constexpr inline int point_size_in_pixels_ = 4; + static constexpr int point_size_in_pixels_ = 4; const double point_size_in_pixels = point_size_in_pixels_ * std::fmax(1, devicePixelRatioF() * .66); }; |