I believe that you will need to use the model object to be able to manipulate the positions of the positions (if that's what you want to do). See an example below; he moves the first element of the abstract model to the bottom.
QAbstractItemModel* model = your_tree_view->model(); QModelIndex index0 = model->index(0, 0); QMap<int, QVariant> data = model->itemData(index0); // check siblings of the item; should be restored later model->removeRow(0); int rowCount = model->rowCount(); model->insertRow(rowCount); QModelIndex index1 = model->index(rowCount, 0); model->setItemData(index1, data);
once an element is moved in the model, your vision widget should update itself accordingly
if you need to resize the element displayed by your tree, set the delegate element and override its sizeHint method
hope this helps, believes
source share