我想在我的 QListView 上实现拖放,所以我想获取所选项目委托(delegate)。我怎样才能做到这一点?
最佳答案
我还没有亲自测试过这一点,但这是我通过阅读 documentation 发现的.
QListView
有一个QList<QModelIndex>
其中包含选定的项目。您可以使用 QListView::selectedIndexes()
访问此列表.
然后您可以调用QAbstractItemView::itemDelegate( const QModelIndex& index )
对于您选择的索引。该函数返回 QAbstractItemDelegate*
.
关于qt - 如何在 QListView 中获取所选项目委托(delegate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7006998/