Drag and Drop

Maximilian Kossick mkossick at gmx.de
Thu Jun 21 16:17:53 CEST 2007


Afaik we can put several different mime types into a QMimeData object, e.g. 
return urls for the url mime type or the album image for an image mime type.

i think we can subclass qmimedata and provide methods to get tracks or 
QueryMakers in the subclass.

then the drag receiver could do this:

QMimeData *mimeData = ...
if( mimeData->hasFormat( "application/x-amarok-tracks" ) )
{
	AmarokMimeData *amarokMimeData = dynamic_cast<AmarokMimeData*>( mimeData );
	Meta::TrackList tracks = amarokMimeData->tracks();
}

or

if( mimeData->hasFormat( "application/x-amarok-querymaker" ) )
{
	AmarokMimeData *amarokMimeData = dynamic_cast<AmarokMimeData*>( mimeData );
	QueryMaker *qm = amarokMimeData->queryMaker();
}

don't forget to check amarokMimeData for 0:)

QMimeData::hasFormat is virtual so this is possible. But i'm not sure if this 
is the way one is supposed to use QMimeData.

On Thursday 21 June 2007, Ian Monroe wrote:
> I was looking at Qt's drag and drop documentation yesterday and was
> thinking about how we would go about implementing it. For Amarok 1.4
> we did stuff like pass around SQL statements.  For 2.0 the ideal would
> be to pass around TrackList's within Amarok and have lists of URLs
> available for when stuff is dragged outside of Amarok. I don't know
> how that would be possible. QMimeData seems pretty limited to text
> stuff, we'd have to be creative. And then how to make it different if
> its dropped outside the application...
>
> Really I'm not really understanding all the drag and drop stuff in general.
>
> Any ideas?
>
> Ian
> _______________________________________________
> Amarok-devel mailing list
> Amarok-devel at kde.org
> https://mail.kde.org/mailman/listinfo/amarok-devel


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/amarok-devel/attachments/20070621/5f12b34e/attachment.pgp 


More information about the Amarok-devel mailing list