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. [SOLVED]How to update QSqlRelationalTableModel internal model?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]How to update QSqlRelationalTableModel internal model?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 1 Posters 3.6k 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.
  • E Offline
    E Offline
    engdarkman89
    wrote on last edited by
    #1

    Hi,

    I will try to explain the problem with the following scenario:

    Suppose we have two tables A and B, table B has a Foreign key column from A and we applied QSqlRelation to that column, now we insert/update a row in table A.

    The problem is that the QSqlRelation still see the old A table, how can i update the relation.?

    Appreciate any kind of help.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      engdarkman89
      wrote on last edited by
      #2

      I tried to call myRelationalTableModel.relationModel(columnIndex).select() after saving changes to table A, but this doesn't solve the problem.

      Serious help needed, please.. :)

      1 Reply Last reply
      0
      • E Offline
        E Offline
        engdarkman89
        wrote on last edited by
        #3

        Help, Help, Help..!!!

        If this problem doesn't have a direct solution, please moderators just tell me..

        1 Reply Last reply
        0
        • E Offline
          E Offline
          engdarkman89
          wrote on last edited by
          #4

          Finally Solved,,

          it was a bug in PyQt4 until version 4.9.5-1, all you have to do is re-select the relation model, like this:

          QSqlRelationalTableModel.relationModel(columnIndex).select()

          1 Reply Last reply
          0
          • I inglis.dl referenced this topic on

          • Login

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