From f7d49232a953d33ee57080193dfdf3d939deef29 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 27 Feb 2010 12:25:47 +0000 Subject: fixed playlist selector git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1592 90c681e8-e032-0410-971d-27865f9a5e38 --- src/ui/playlistselector.cpp | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/ui/playlistselector.cpp') diff --git a/src/ui/playlistselector.cpp b/src/ui/playlistselector.cpp index e63056c89..8d84750a4 100644 --- a/src/ui/playlistselector.cpp +++ b/src/ui/playlistselector.cpp @@ -36,6 +36,8 @@ PlayListSelector::PlayListSelector(PlayListManager *manager, QWidget *parent) : { m_update = FALSE; m_scrollable = FALSE; + m_left_pressed = FALSE; + m_right_pressed = FALSE; m_offset = 0; m_offset_max = 0; m_skin = Skin::instance(); @@ -155,6 +157,8 @@ void PlayListSelector::mousePressEvent (QMouseEvent *e) { m_offset += m_rects.at(lastVisible()).right() - m_offset - width() + 42; m_offset = qMin(m_offset, m_offset_max); + m_right_pressed = TRUE; + drawButtons(); update(); return; } @@ -162,6 +166,8 @@ void PlayListSelector::mousePressEvent (QMouseEvent *e) { m_offset -= 11 - m_rects.at(firstVisible()).x() + m_offset; m_offset = qMax(0, m_offset); + m_left_pressed = TRUE; + drawButtons(); update(); return; } @@ -181,9 +187,18 @@ void PlayListSelector::mousePressEvent (QMouseEvent *e) m_menu->exec(e->globalPos()); } +void PlayListSelector::mouseReleaseEvent (QMouseEvent *e) +{ + m_left_pressed = FALSE; + m_right_pressed = FALSE; + drawButtons(); + update(); + QWidget::mouseReleaseEvent(e); +} + void PlayListSelector::mouseDoubleClickEvent (QMouseEvent *e) { - if(e->button() == Qt::LeftButton) + if(e->button() == Qt::LeftButton && !(m_scrollable && (e->x() > width() - 40))) renamePlaylist(); else QWidget::mouseDoubleClickEvent(e); @@ -207,19 +222,20 @@ void PlayListSelector::drawButtons() m_pixmap = QPixmap(40, height()); m_pixmap.fill(m_normal_bg); QPainter painter(&m_pixmap); - painter.setPen(m_normal); - painter.setBrush(QBrush(m_normal)); + painter.setPen(m_left_pressed ? m_current : m_normal); + painter.setBrush(QBrush(m_left_pressed ? m_current : m_normal)); QPoint points[3] = { - QPoint(m_pixmap.width() - 25, height()/2 - 6), + QPoint(m_pixmap.width() - 25, height()/2 - 5), QPoint(m_pixmap.width() - 35, height()/2-1), - QPoint(m_pixmap.width() - 25, height()/2 + 4), + QPoint(m_pixmap.width() - 25, height()/2 + 3), }; painter.drawPolygon(points, 3); - + painter.setPen(m_right_pressed ? m_current : m_normal); + painter.setBrush(QBrush(m_right_pressed ? m_current : m_normal)); QPoint points2[3] = { - QPoint(m_pixmap.width() - 20, height()/2 - 6), + QPoint(m_pixmap.width() - 20, height()/2 - 5), QPoint(m_pixmap.width() - 10, height()/2-1), - QPoint(m_pixmap.width() - 20, height()/2 + 4), + QPoint(m_pixmap.width() - 20, height()/2 + 3), }; painter.drawPolygon(points2, 3); } -- cgit v1.2.3-13-gbd6f