QAbstractItemModel::canDropMimeData
C++ (Qt)// mouse is inbetween item1 & item2 (onr can be null)bool CanInsertHere( QTreeWidgetItem *& item1, QTreeWidgetItem *& item2 ){ while (item2 && item2->isSelected()) item2 = itemBelow(item2); if (item2 && item2->HasSelectedParent()) return false; // can't insert here while (item1 && (item1->isSelected() || item1->HasSelectedParent())) item1 = itemAbove(item1); return item1 || item2;}