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
This commit is contained in:
Tobias Doerffel
2008-08-23 19:17:44 +00:00
parent a6e40f5438
commit 989bacb799

View File

@@ -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() );