Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAbstractItemModel::beginMoveRows 2 times or how to implement swapping in DataModel?

QAbstractItemModel::beginMoveRows 2 times or how to implement swapping in DataModel?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 829 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kofr
    wrote on last edited by
    #1

    Hello. I have DataModel which inherits QAbstractItemModel with Tree data structure.
    I have a method QAbstractItemModel::moveRows which swaps source and destination rows in case if they are one right after another (i.e. rows 5 and 6), but QAbstractItemModel::beginMoveRows can process only one source row at a time. So in case with swapping I move 2 rows simultaneously. So, how can I make swap (moves) right way?
    p.s. Details of my implementation does not allow to detach one move from another.

    1 Reply Last reply
    0
    • BjornWB Offline
      BjornWB Offline
      BjornW
      wrote on last edited by
      #2

      Maybe I am misunderstanding, but isn't "swapping" 5 and 6 the same as moving row 6 before 5? No need to move 5?

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved