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. Table and Forms to edit records
Forum Updated to NodeBB v4.3 + New Features

Table and Forms to edit records

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.3k 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
    confused
    wrote on last edited by
    #1

    I'm brand new to Qt so I'm not sure if this is exactly where I should post something like this so sorry if its not, just let me know where would be better.

    I'm trying to create a data base with MS SQL and a GUI for users to edit it with. I found this chaper of a book that does something similar to what I want http://www.informit.com/articles/article.aspx?p=1405550&seqNum=3 and I think the code is download able here: http://www.informit.com/store/product.aspx?isbn=0132354160&DCSext.w_ptgrevartcl=C+++GUI+Programming+with+Qt4_1405550_ISBNTopTitle

    I eventually want to make my application do more than that does like print and have an active botton for each record and a few other things but I don't know much about Qt right now and can worry about that later.
    My main problem right now is that I only need 1 table not 2 linked tables which I think I've figured out for the 1st window that comes up but not with the 2nd window, the editing form. Basically I need a similar window and all to what is done in that section and the next of the chapter, that displays the records and then opens a form to edit them but only uses one table. Can anyone change this code easily to do that or know of another book/tutorial that I can read online and see the code to figure this out?

    thanks

    1 Reply Last reply
    0
    • C Offline
      C Offline
      confused
      wrote on last edited by
      #2

      I'm not trying to get someone to do the work for me as I realize it seems at one point but I have already modified the code most of the way to create and display just one table on the 1st, "display", window, I think, but I cant really test it since I am creating my code as I read along the chapter. But QSqlRelationalTableModel is used a lot and there are some points where I dont know what to substitute for it or its functions or if I even need that section of code for what I need to do.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        franku
        wrote on last edited by
        #3

        I am a bit confused. You want to download some code? Hmm, for reading I recommend this "author":http://www.qtrac.eu/marksummerfield.html:. In his books you will find many examples and descriptions line by line, as well as downloadable source code.

        This, Jen, is the internet.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          franku
          wrote on last edited by
          #4

          Try QSqlTableModel if you do not use relations in your tables. If you set this as the model for a QTableView you have a good starting point on viewing and edition tables based on a database.

          This, Jen, is the internet.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            confused
            wrote on last edited by
            #5

            [quote author="franku" date="1342024713"]I am a bit confused. You want to download some code? Hmm, for reading I recommend this "author":http://www.qtrac.eu/marksummerfield.html:. In his books you will find many examples and descriptions line by line, as well as downloadable source code. [/quote]

            I dont have to download code I just say that because I would prefer to be able to see the whole code together as it should be written, since I am still learning Qt, instead of spread out in unordered snippets like in the chapter in the link i posted.
            But I will check that link out thanks franku.

            1 Reply Last reply
            0
            • F Offline
              F Offline
              franku
              wrote on last edited by
              #6

              AFAIK those books (found at your link as well) provide less complex examples on how to use the model/view with SQLTables in comparison to the mentioned above or at least getting started with Qt. You may also have a look at the QT documentation, there you will find code snippets that might help your code get running. Maybe "this":http://doc.qt.nokia.com/4.7-snapshot/qsqltablemodel.html#details is a starting point for a small table example.

              This, Jen, is the internet.

              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