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. How to abort beginInsertRows()?

How to abort beginInsertRows()?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.3k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    Philius
    wrote on last edited by
    #1

    I've got a tree model + view and I'm dragging and dropping to my hearts content.
    Even the shift key works as a "move" operation.

    The problem is that the underlying data source is a disk file with some hard constraints as to its size, so one day soon I'll call beginInsertRows, try to insert the rows and it will fail.

    Am I missing something? There isn't an abortInsertRows() that I can see.
    Also, it's not clear whether I can call beginResetModel() before endInsertRows().

    I'm using "ModelTest":http://qt-project.org/wiki/Model_Test after inserting
    @#undef QVERIFY
    #define QVERIFY Q_ASSERT
    @

    I can use it in a regular application - it's happy, so I think I've gone as far as I can without a definitive answer.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on last edited by
      #2

      Had the same problem some time ago and it seems a corresponding abortInsertRows (which would also need to signal to the views) was just forgotten. I "fixed" it by doing the operations that could fail before signaling anything, in a buffer so to say, and when it succeeded finally called beginInsertRows, inserted the buffer into the model and finished normally with endInsertRows.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        IIRC there are no abort messages for any beginXXX endXXX functions. The idea is if you start inserting, you should also finish it. The other option is to use endXXXa dn reset (with the side effect of trees being closed ;-( ).

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0

        • Login

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