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:
@@ -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() );
|
||||
|
||||
Reference in New Issue
Block a user