Has anybody tried the new 'QAbstractItemModel::moveRow(...)' in Qt5 already?
There is a new function in Qt5:
@bool QAbstractItemModel::moveRow(const QModelIndex & sourceParent, int sourceRow, const QModelIndex & destinationParent, int destinationChild)@
Has anybody tried it already and was successful?
The doc file says: "On models that support this, moves sourceRow from sourceParent to destinationChild under destinationParent." but nothing about which models are supporting this function.
I've tried it with
@tableModel->moveRow ( tableView->currentIndex(),
tableView->currentIndex().row() +2 );@
No problem to compile but when I'm calling this function with qDebug(), it returns 'false' only and that's all.
Hi and welcome to devnet,
AFAIK, moveRow is currently only implemented in QAbstractItemModel and does nothing.
It's not the answer I like, specially where I have spent at least two hours to get it working, but I guess you are right ...
I really should not try new things after midnight when I'm tired. ;-)
seems like this is a rather old topic, but I would like to bring it up again, since I am also in the need of these functions.
Am I right to assume that we need to implement the moveRow and moveRows methods in our models in order to get these functions working?
Thanks in advance,