Hack to prevent the user from dragging album covers around.

This commit is contained in:
David Sansome 2010-06-12 17:32:27 +00:00
parent 36abad486b
commit c37933c370
2 changed files with 12 additions and 1 deletions

View File

@ -20,8 +20,8 @@
#include <boost/scoped_ptr.hpp>
#include <QDropEvent>
#include <QUrl>
#include <QtDebug>
AlbumCoverManagerList::AlbumCoverManagerList(QWidget *parent)
: QListWidget(parent),
@ -55,3 +55,13 @@ QMimeData* AlbumCoverManagerList::mimeData(const QList<QListWidgetItem*> items)
mime_data->setData(orig_data->formats()[0], orig_data->data(orig_data->formats()[0]));
return mime_data;
}
void AlbumCoverManagerList::dropEvent(QDropEvent* e) {
// Set movement to Static just for this dropEvent so the user can't move the
// album covers. If it's set to Static all the time then the user can't even
// drag to the playlist
QListWidget::Movement old_movement = movement();
setMovement(QListWidget::Static);
QListWidget::dropEvent(e);
setMovement(old_movement);
}

View File

@ -30,6 +30,7 @@ public:
protected:
QMimeData* mimeData(const QList<QListWidgetItem*> items) const;
void dropEvent(QDropEvent *event);
private:
AlbumCoverManager* manager_;