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

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.
  • S Offline
    S Offline
    Sudo007
    wrote on 18 Aug 2016, 08:06 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
    • V Offline
      V Offline
      VRonin
      wrote on 18 Aug 2016, 08:47 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

      S 1 Reply Last reply 18 Aug 2016, 09:19
      1
      • V VRonin
        18 Aug 2016, 08:47

        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

        S Offline
        S Offline
        Sudo007
        wrote on 18 Aug 2016, 09:19 last edited by
        #3

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

        1 Reply Last reply
        0
        • V Offline
          V Offline
          VRonin
          wrote on 18 Aug 2016, 09:24 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

          4/4

          18 Aug 2016, 09:24

          • Login

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