From f7b357bb29788b220d6839793e9c7d4dbac05870 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Mon, 20 Aug 2012 16:53:26 -0400 Subject: [PATCH] Allow clicking on any part of the button --- src/widgets/SlideSwitchButton.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/SlideSwitchButton.cpp b/src/widgets/SlideSwitchButton.cpp index 392e37460..39af6ce40 100644 --- a/src/widgets/SlideSwitchButton.cpp +++ b/src/widgets/SlideSwitchButton.cpp @@ -118,7 +118,7 @@ SlideSwitchButton::mousePressEvent( QMouseEvent* e ) void SlideSwitchButton::mouseReleaseEvent( QMouseEvent* e ) { - const int delta = e->pos().x() - m_mouseDownPos.x(); + const int delta = m_mouseDownPos.isNull() ? 0 : e->pos().x() - m_mouseDownPos.x(); m_mouseDownPos = QPoint(); // Only act as a real button if the user didn't drag