diff --git a/ChangeLog b/ChangeLog index 812aeb780..a8e938ac7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-01-03 Paul Giblock + + * src/gui/widgets/automatable_button.cpp: + fix drag support for button groups + 2008-12-22 Tobias Doerffel * CMakeLists.txt: diff --git a/src/gui/widgets/automatable_button.cpp b/src/gui/widgets/automatable_button.cpp index 146493f23..10ccfec17 100644 --- a/src/gui/widgets/automatable_button.cpp +++ b/src/gui/widgets/automatable_button.cpp @@ -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 ); + } } }