Give pixmap buttons feedback on click
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@976 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -146,6 +146,8 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
void automatableButton::mouseReleaseEvent( QMouseEvent * _me )
|
||||
{
|
||||
// TODO: Fix this. for example: LeftDown, RightDown, Both Released causes two events
|
||||
// or - pressing down then releasing outside of the bbox causes click event.
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
pixmapButton::pixmapButton( QWidget * _parent, const QString & _name ) :
|
||||
automatableButton( _parent, _name ),
|
||||
m_activePixmap(),
|
||||
m_inactivePixmap()
|
||||
m_inactivePixmap(),
|
||||
m_pressed( FALSE )
|
||||
{
|
||||
setActiveGraphic( embed::getIconPixmap( "led_yellow" ) );
|
||||
setInactiveGraphic( embed::getIconPixmap( "led_off" ), FALSE );
|
||||
@@ -58,7 +59,7 @@ void pixmapButton::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
|
||||
if( model()->value() )
|
||||
if( model()->value() || m_pressed )
|
||||
{
|
||||
if( !m_activePixmap.isNull() )
|
||||
{
|
||||
@@ -85,12 +86,27 @@ void pixmapButton::mousePressEvent( QMouseEvent * _me )
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show pressing graphics if this isn't checkable
|
||||
if( !isCheckable() )
|
||||
{
|
||||
m_pressed = TRUE;
|
||||
update();
|
||||
}
|
||||
|
||||
automatableButton::mousePressEvent( _me );
|
||||
}
|
||||
}
|
||||
|
||||
void pixmapButton::mouseReleaseEvent( QMouseEvent * _me )
|
||||
{
|
||||
automatableButton::mouseReleaseEvent( _me );
|
||||
|
||||
|
||||
if( !isCheckable() )
|
||||
{
|
||||
m_pressed = FALSE;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void pixmapButton::mouseDoubleClickEvent( QMouseEvent * _me )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user