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 does QSqlRelationalTableModel know which DB to use?
Qt 6.11 is out! See what's new in the release blog

How does QSqlRelationalTableModel know which DB to use?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 587 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.
  • C Offline
    C Offline
    cmulcahy
    wrote on last edited by
    #1

    I am writing a database application using SQLite. I can manually run queries and populate fields but want to use a QSqlRelationalTableModel. I see in the example a very simple process for using it. It isn't working quite right for me, though.

    I have a DB connection in a global connection that I was using in the old style that worked quite well. I am not sure how to tell the QSqlRelationalTableModel to use that DB connection. Where do I tie the open database to the model?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @cmulcahy said:
      hi
      it takes a db in constructor
      http://doc.qt.io/qt-5/qsqlrelationaltablemodel.html#QSqlRelationalTableModel

      1 Reply Last reply
      1
      • C Offline
        C Offline
        cmulcahy
        wrote on last edited by
        #3

        And the award for missing the most obvious answer goes to me.

        Thanks!

        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