From 9e63b4ecafcb66c275760cd28d2cfb0d258a474e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 5 Sep 2016 18:24:01 +0200 Subject: spline-widget: stop dragging when alt-tabbing away Unfortunately now spline widgets grab keyboard focus. Qt doesn't seem to have a better way to detect whether some other application gained focus. --- spline-widget/spline-widget.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spline-widget/spline-widget.hpp') diff --git a/spline-widget/spline-widget.hpp b/spline-widget/spline-widget.hpp index 53560d6a..477e3ba6 100644 --- a/spline-widget/spline-widget.hpp +++ b/spline-widget/spline-widget.hpp @@ -22,6 +22,7 @@ using namespace options; #include #include #include +#include #include #include @@ -74,7 +75,8 @@ private: void drawPoint(QPainter& painter, const QPointF& pt, const QColor& colBG, const QColor& border = QColor(50, 100, 120, 200)); void drawLine(QPainter& painter, const QPoint& start, const QPoint& end, const QPen& pen); bool point_within_pixel(const QPointF& pt, const QPoint& pixel); -protected: + + void focusOutEvent(QFocusEvent*e) override; void resizeEvent(QResizeEvent *) override; private: bool is_on_pt(const QPoint& pos, int* pt = nullptr); -- cgit v1.2.3