Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QListView loses data when QSqlTableModel submitAll() is called
Qt 6.12 LTS is out! See what's new in the release blog

QListView loses data when QSqlTableModel submitAll() is called

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 778 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hey,

    I have QSortFilterProxyModel in a QListView:

    //mGermanFungusNameFilter = QSortFilterProxyModel
    //mGermanNames = QSqlTableModel
    //mGermanNameEditor = QListView
    mGermanNameFilter->setSourceModel(mGermanNames);
    mGermanNameEditor->setModel(mGermanNameFilter);
    mGermanNameEditor->setModelColumn(1);
    

    If I have edited (updated) the data and then call mGermanNames->submitAll() via a QPushButton, all data disappears from the QListView.

    What have I forgotten? Can't QStyledItemDelegate handle a QSortFilterProxyModel? Or how do I write the data from a QSortFilerProxyModel back to the database (SQLITE)?

    Thanks for your help!

    JonBJ 1 Reply Last reply
    0
    • ? A Former User

      Hey,

      I have QSortFilterProxyModel in a QListView:

      //mGermanFungusNameFilter = QSortFilterProxyModel
      //mGermanNames = QSqlTableModel
      //mGermanNameEditor = QListView
      mGermanNameFilter->setSourceModel(mGermanNames);
      mGermanNameEditor->setModel(mGermanNameFilter);
      mGermanNameEditor->setModelColumn(1);
      

      If I have edited (updated) the data and then call mGermanNames->submitAll() via a QPushButton, all data disappears from the QListView.

      What have I forgotten? Can't QStyledItemDelegate handle a QSortFilterProxyModel? Or how do I write the data from a QSortFilerProxyModel back to the database (SQLITE)?

      Thanks for your help!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Gabber
      bool QSqlTableModel::submitAll():

      In OnManualSubmit, on success the model will be repopulated. Any views presenting it will lose their selections.

      I presume you are using OMS. Check submitAll() succeeded. Check data got re-read. Check how many rows in SQL source model now. Check what filter is in QSFPM. Check how many rows that has. Check what your QListView is attached to, and how many rows it has. Check QSFPM is still accessing QSTM, it should not need it but you can always do a refresh to make sure. Find out where issue lies between QSTM, QSFPM & QLV!

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @JonB said in QListView loses data when QSqlTableModel submitAll() is called:

        I presume you are using OMS

        Yes, you are right.

        The model had only 256 rows. With canFetchMore() and fetchMore() after submitAll() it works now.

        When I double click on the selected item I only have a small edit window (see picture). Is it possible to extend this to the whole length (like the blue bar)? And also adjust the height because part of the font is cut off....

        Bildschirmfoto vom 2022-09-28 16-15-14.png

        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
        • Unsolved