Thanks, that works using this code :
{
public:
{
}
protected:
virtual void startDrag( Qt::DropActions supportedActions )
{
const QModelIndexList indexes = selectedIndexes();
Drag.setMimeData( model()->mimeData( indexes ) );
Drag.exec( supportedActions );
}
};
class CListView : public QListView
{
public:
CListView( QWidget* Parent ) :
QListView( Parent )
{
}
protected:
virtual void startDrag( Qt::DropActions supportedActions )
{
QDrag Drag( this );
const QModelIndexList indexes = selectedIndexes();
Drag.setMimeData( model()->mimeData( indexes ) );
Drag.exec( supportedActions );
}
};
To copy to clipboard, switch view to plain text mode
Is it possible to only hide the pixmap when it's outside of the QListView ?
Maybe "dragLeaveEvent ( QDragLeaveEvent * e )" is a way to think about but then "QDrag Drag( this );" has to be stored ?
But still the problem of "m_DetailList->setViewMode( QListView::IconMode );".
It's impossible to drag and drop internaly using QListView with IconMode.
Using "QListView::ListMode" that works normally.
I hope you know the solution.
EDIT : Apparently it's because "m_DetailList->setMovement( QListView::Static );"
But without it, you can move items that is not good for what I do, does a way exist to just allow drag and drop but not move ?
Thanks
EDIT2 : Here the solution of the Static problem :
m_DetailList
->setMovement
( QListView::Snap );
m_DetailList->setMovement( QListView::Snap );
To copy to clipboard, switch view to plain text mode
{
if( indexAt( e->pos() ).isValid() )
else
e->ignore();
}
virtual void dropEvent( QDropEvent* e )
{
if( indexAt( e->pos() ).isValid() )
QListView::dropEvent( e );
else
e->ignore();
}
To copy to clipboard, switch view to plain text mode
I do all that under your control, say me if what I do is not correct.
Bookmarks