From 989bacb799f0eb436f19e8ecade48a141f95690d Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sat, 23 Aug 2008 19:17:44 +0000 Subject: [PATCH] if no pixmap was given and parent-widget is valid, use a snapshot of the widget as drag-icon git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1476 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/gui/string_pair_drag.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/string_pair_drag.cpp b/src/gui/string_pair_drag.cpp index 7e6938ea0..63c4058b0 100644 --- a/src/gui/string_pair_drag.cpp +++ b/src/gui/string_pair_drag.cpp @@ -41,7 +41,17 @@ stringPairDrag::stringPairDrag( const QString & _key, const QString & _value, const QPixmap & _icon, QWidget * _w ) : QDrag( _w ) { - setPixmap( _icon ); + if( _icon.isNull() && _w ) + { + setPixmap( QPixmap::grabWidget( _w ).scaled( + 64, 64, + Qt::KeepAspectRatio, + Qt::SmoothTransformation ) ); + } + else + { + setPixmap( _icon ); + } QString txt = _key + ":" + _value; QMimeData * m = new QMimeData(); m->setData( mimeType(), txt.toAscii() );