diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-26 17:15:44 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-26 17:32:53 +0200 |
commit | 00693645d876ff969a865e7f609abdc474750c77 (patch) | |
tree | e640eba95da0adb01e972dd0ae666304b976ec62 /spline-widget/qfunctionconfigurator.h | |
parent | 413834ae826a87edcfa986561ed7bfcee6d84442 (diff) |
spline-widget: misc fixes
- Remove some copy-pasted code
- Don't do too much QPainter stuff in a hot loop
- Use float/double/int correctly
- Whitespace
- C++11 style
- Update copyright
Diffstat (limited to 'spline-widget/qfunctionconfigurator.h')
-rw-r--r-- | spline-widget/qfunctionconfigurator.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/spline-widget/qfunctionconfigurator.h b/spline-widget/qfunctionconfigurator.h index ce8208a8..ffd1dd78 100644 --- a/spline-widget/qfunctionconfigurator.h +++ b/spline-widget/qfunctionconfigurator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015 Stanislaw Halik <sthalik@misaki.pl> +/* Copyright (c) 2012-2016 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 @@ -19,13 +19,12 @@ class SPLINE_WIDGET_EXPORT QFunctionConfigurator : public QWidget { Q_OBJECT Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier) - enum { pointSize = 5 }; public: QFunctionConfigurator(QWidget *parent = 0); - + Map* config(); void setConfig(Map* config, const QString &name); - + QColor colorBezier() const { return spline_color; @@ -57,23 +56,26 @@ protected: void resizeEvent(QResizeEvent *) override; private: void update_range(); - static constexpr int point_closeness_limit = 12; QPointF pixel_coord_to_point (const QPointF& point); - QPointF point_to_pixel (const QPointF& point); + QPointF point_to_pixel(const QPointF& point); Map* _config; - + // bounds of the rectangle user can interact with QRectF pixel_bounds; - + int moving_control_point_idx; QPointF c; QColor spline_color; - + QPixmap _background; QPixmap _function; bool _draw_function; int snap_x, snap_y; + + static constexpr int line_length_pixels = 3; + static constexpr int point_size = 5; + static constexpr int point_closeness_limit = 12; }; |