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 to fill a QSqlTableModel from dbf file
Forum Updated to NodeBB v4.3 + New Features

How to fill a QSqlTableModel from dbf file

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.8k 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.
  • M Offline
    M Offline
    marceloarguello700
    wrote on last edited by
    #1

    i need to fill a QSqlTableModel with data comming from dbf file
    the question is i need to create a QSqlDatabase in memory
    or can do in direct way and how ?

    To parse the dbf file use Xbase:
    http://code.google.com/p/qtdbf/source/browse/trunk/qtdbf/src/?r=24

    Need the next step.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      topse
      wrote on last edited by
      #2

      You need a QSqlDatabase to use the QSqlTableModel. Do you have a database-driver compatible with XBase and QSqlDatabase?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        This "thread":http://qt-project.org/forums/viewthread/8459 might help

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • M Offline
          M Offline
          marceloarguello700
          wrote on last edited by
          #4

          Thanks for the reply.
          The question is not about the driver to read the dbf file
          I dont want to use Access Odbc o wherever.
          Forget the source of data, think that i have a QList

          The question is if i need to create a QSqlDatabase or if the QSqlTableModel
          can work alone, and how fill it from the QList in a clasic while loop.

          Greetings

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Yes you need to, as it names implies QSqlTableModel needs a database behind it. You can use an in memory sqlite database if you don't want to store things permanently.

            Depending on your list content you can use e.g. QStringListModel or you can create your on own model that handles that list.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • M Offline
              M Offline
              marceloarguello700
              wrote on last edited by
              #6

              Thanks, now understand why I was trying to work alone and nothing hapen.
              Now will research about the QStringListModel.

              Greetings

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