diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-05-14 15:38:37 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-05-14 15:38:37 +0000 |
| commit | 26fe811fd00b92f8d53659e856f75d757c6a0307 (patch) | |
| tree | 54a7081ebb4dcf8db8d9b5af44fd3032279e44b6 /src/ui/button.cpp | |
| parent | d3fe99a66eb976924899ee93452c3277e33cff2b (diff) | |
| download | qmmp-26fe811fd00b92f8d53659e856f75d757c6a0307.tar.gz qmmp-26fe811fd00b92f8d53659e856f75d757c6a0307.tar.bz2 qmmp-26fe811fd00b92f8d53659e856f75d757c6a0307.zip | |
fixed skinned button bug
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2193 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui/button.cpp')
| -rw-r--r-- | src/ui/button.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/ui/button.cpp b/src/ui/button.cpp index 9b96f8f52..f07088b0b 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2008 by Ilya Kotov * + * Copyright (C) 2007-2011 by Ilya Kotov * * forkotov02@hotmail.ru * * * * Based on Promoe, an XMMS2 Client * @@ -31,6 +31,7 @@ Button::Button (QWidget *parent, uint normal, uint pressed, uint cursor) name_normal = normal; name_pressed = pressed; name_cursor = cursor; + m_pressed = false; skin = Skin::instance(); setON (false); setCursor (skin->getCursor (name_cursor)); @@ -56,25 +57,26 @@ void Button::setON (bool on) } void Button::mousePressEvent (QMouseEvent *e) { + if(e->button() != Qt::LeftButton) + return; setON (true); - m_cursorin = true; + m_pressed = true; QWidget::mousePressEvent(e); } -void Button::mouseReleaseEvent (QMouseEvent*) +void Button::mouseReleaseEvent (QMouseEvent *e) { - setON (false); - if (m_cursorin) + if (!m_pressed) + return; + m_pressed = false; + if(rect().contains(e->pos())) + { + setON (false); 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); - } + setON (m_pressed && rect().contains(e->pos())); } |
