Frage

I want to implement drag and drop on my QListView, so I would like to get the selected item delegate. How can I do that?

War es hilfreich?

Lösung

I haven't tested this for myself, but this is what I found out by reading the documentation.

QListView has a QList<QModelIndex> which contains the selected items. You can access this list using QListView::selectedIndexes().

Then you can call QAbstractItemView::itemDelegate( const QModelIndex& index ) for your selected index. This function returns a QAbstractItemDelegate*.

Andere Tipps

I'm not sure if this will help You, but You can use this functions:

void QListView::currentChanged ( const QModelIndex & current, const QModelIndex & previous ) [virtual protected]

and

void QAbstractItemView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) [virtual protected slot]

and refer to Qt QAbstractItemView class documentation

greetings Robert

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top