I working on a small QlistView which is Sortable.
iListView = new QListView(this);
//Creating a standard item model
iStandardModel = new QStandardItem
That is because by default QStandardItem
has Qt::ItemIsDropEnabled
flag set. Just remove it by using QStandardItem::setFlags()
function. Add following lines:
item1->setFlags(item1->flags() ^ (Qt::ItemIsDropEnabled));
item2->setFlags(item2->flags() ^ (Qt::ItemIsDropEnabled));
item3->setFlags(item3->flags() ^ (Qt::ItemIsDropEnabled));
iListView->showDropIndicator(); // For convenience..