Fix drag-drop for buttonGroups

Previously a boolean model would be dragged when Ctrl-Dragging on a
button belonging to a button group.  This fix causes the integer-model
of the group to be dragged instead.

The original behavior would allow the user to toggle multiple values
simultaneously by using several automation tracks.  Plus, I would think
this new behavior is more convenient.

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1968 0778d3d1-df1d-0410-868b-ea421aaaa00d

Conflicts:
	ChangeLog.old
	src/gui/widgets/automatable_button.cpp
This commit is contained in:
Paul Giblock
2009-01-03 20:34:18 +00:00
committed by Paul Giblock
parent 642aa97198
commit 487335a4ec
2 changed files with 24 additions and 3 deletions

View File

@@ -158,6 +158,11 @@
* plugins/flp_import/unrtf/convert.c:
Avoid compile warnings
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

@@ -32,7 +32,7 @@
#include "engine.h"
#include "embed.h"
#include "MainWindow.h"
#include "string_pair_drag.h"
@@ -115,6 +115,7 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
if( _me->button() == Qt::LeftButton &&
! ( _me->modifiers() & Qt::ControlModifier ) )
{
// User simply clicked, toggle if needed
if( isCheckable() )
{
toggle();
@@ -123,8 +124,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 );
}
}
}