diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-09-15 19:09:22 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-09-15 19:09:22 +0000 |
| commit | 1a24a61265d498ab3948c79c99efdc53f576dc61 (patch) | |
| tree | b639eb4c3faca784b281d256e8c0cc7828ca23f7 /src/ui/button.cpp | |
| parent | ab254070bb91752d40dfc581e9c09f3816b7af0f (diff) | |
| download | qmmp-1a24a61265d498ab3948c79c99efdc53f576dc61.tar.gz qmmp-1a24a61265d498ab3948c79c99efdc53f576dc61.tar.bz2 qmmp-1a24a61265d498ab3948c79c99efdc53f576dc61.zip | |
fixed button focus behavior (patch by erlk.ozlr AT gmail.com)
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1224 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui/button.cpp')
| -rw-r--r-- | src/ui/button.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ui/button.cpp b/src/ui/button.cpp index b9ee9cf09..4ec67ac4d 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -23,6 +23,7 @@ #include "button.h" #include "skin.h" +#include <QMouseEvent> Button::Button (QWidget *parent, uint normal, uint pressed) : PixmapWidget (parent) @@ -53,11 +54,24 @@ void Button::setON (bool on) void Button::mousePressEvent (QMouseEvent *e) { setON (TRUE); + m_cursorin = TRUE; QWidget::mousePressEvent(e); } void Button::mouseReleaseEvent (QMouseEvent*) { setON (FALSE); - emit clicked(); + if (m_cursorin) + emit clicked(); +} + +void Button::mouseMoveEvent (QMouseEvent *e) +{ + if ( !m_cursorin && rect().contains(e->pos()) ) { + m_cursorin = TRUE; + setON (TRUE); + } else if ( m_cursorin && !rect().contains(e->pos()) ) { + m_cursorin = FALSE; + setON (FALSE); + } } |
