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(),
    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.

    Any ideas?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, moveRow is currently only implemented in QAbstractItemModel and does nothing.



  • Thanks SGaist!

    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. ;-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.