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. Regarding overwritting the existing data in the QSqlRelationalTableModel
Forum Updated to NodeBB v4.3 + New Features

Regarding overwritting the existing data in the QSqlRelationalTableModel

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsqlrelationaltqt 4.8
4 Posts 2 Posters 1.2k 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.
  • Sudo007S Offline
    Sudo007S Offline
    Sudo007
    wrote on last edited by Sudo007
    #1

    Qt 4.8
    Does the QSqlRelationalTableModel::setFilter() overwrite the existing data in the model?
    myModelModel->setFilter( QString("QueueID=%1 LIMIT %2 ,%3")
    .arg( m_QueueId )
    .arg( fromIndex )
    .arg( toIndex ) );
    if i call the myModelModel->rowCount(), it gives the total no. (existing + after filtered out).

    how to get overwritting, i want rowCount of the model same always.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      QSqlRelationalTableModel::setFilter() works calling a select so it will rebuild the model. You could use or subclass QSortFilterProxyModel to do the filtering and retain the original model

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      Sudo007S 1 Reply Last reply
      1
      • VRoninV VRonin

        QSqlRelationalTableModel::setFilter() works calling a select so it will rebuild the model. You could use or subclass QSortFilterProxyModel to do the filtering and retain the original model

        Sudo007S Offline
        Sudo007S Offline
        Sudo007
        wrote on last edited by
        #3

        @VRonin you mean after filtering out, existing data will be overritten.

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          yes, calling setfilter will call select using the filter argument as WHERE clause so resetting the whole model

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          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