Fix drag-drop for buttonGroups

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1968 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2009-01-03 20:34:18 +00:00
parent ed5925da0a
commit 7bc1252784
2 changed files with 24 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
2009-01-03 Paul Giblock <drfaygo/at/gmail/dot/com>
* src/gui/widgets/automatable_button.cpp:
fix drag support for button groups
2008-12-22 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* CMakeLists.txt:

View File

@@ -35,6 +35,7 @@
#include "engine.h"
#include "embed.h"
#include "main_window.h"
#include "string_pair_drag.h"
@@ -117,6 +118,7 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
if( _me->button() == Qt::LeftButton &&
! ( _me->modifiers() & Qt::ControlModifier ) )
{
// User simply clicked, toggle if needed
if( isCheckable() )
{
toggle();
@@ -125,8 +127,23 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
}
else
{
automatableModelView::mousePressEvent( _me );
QPushButton::mousePressEvent( _me );
// Ctrl-clicked, need to prepare drag-drop
if( m_group )
{
// A group, we must get process it instead
automatableModelView* groupView = (automatableModelView*)m_group;
new stringPairDrag( "automatable_model",
QString::number( groupView->modelUntyped()->id() ),
QPixmap(), widget() );
// TODO: ^^ Maybe use a predefined icon instead of the button they happened to select
_me->accept();
}
else
{
// Otherwise, drag the standalone button
automatableModelView::mousePressEvent( _me );
QPushButton::mousePressEvent( _me );
}
}
}