From a64ffe1153d7b637007c2dde8bd39c559c97a1fe Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Murcia Date: Tue, 19 Feb 2019 16:56:26 +0100 Subject: Added support for sensor leaving events with delay support Here delay means the time the mouse has to be in the sensor for the leave event to trigger the action Signed-off-by: Alexis Maiquez Murcia --- src/sensor.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/sensor.h') diff --git a/src/sensor.h b/src/sensor.h index ed5add8..bc4857b 100644 --- a/src/sensor.h +++ b/src/sensor.h @@ -41,7 +41,7 @@ class Sensor : public QWidget Q_OBJECT public: - explicit Sensor(int x, int y, int w, int h, QString action, int interval); + explicit Sensor(int x, int y, int w, int h, QString enterAction, QString exitAction, int enterInterval, int exitInterval); ~Sensor(); protected: @@ -49,12 +49,17 @@ protected: void leaveEvent(QEvent * event); private: - QString action; - QTimer *timer; - int interval; + QString enterAction; + QString exitAction; + QTimer *enterTimer; + QTimer *exitTimer; + int enterInterval; + int exitInterval; + bool canTriggerExit; public slots: - void activate(); + void activateEnter(); + void activateExit(); }; -- cgit v1.2.3