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. Tips to start to work with mysql
Forum Updated to NodeBB v4.3 + New Features

Tips to start to work with mysql

Scheduled Pinned Locked Moved Unsolved General and Desktop
databasetreeviewmysql
6 Posts 3 Posters 2.7k 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.
  • W Offline
    W Offline
    WarOfDevil
    wrote on 8 Jun 2016, 16:56 last edited by WarOfDevil 6 Aug 2016, 16:57
    #1

    Hi guys, it's the first time that i program with QT5 and mysql database also. Before to ask help i will show you the small database that i have to use and the gui of my application:

    DB: http://s33.postimg.org/qqht3dc6n/Table.png
    GUI: http://s33.postimg.org/cjtc013hr/gui.jpg

    That's a small application that allow the user to store electronic component in the database, take care of datasheet and the location where they are stored, really simple.
    Now, i made the connection with the database in my code and everything it's fine, i can also run simple query and print result with qDebug.

    • How can i show in the TreeView the category table (without the ID), and if the user click on the plus to expand the child will show the subcategory table (also without ID)?

    I just want to say that the treeView and tableView will be read-only, to update or add something in the database i will select a row in the table and press a button to add, remove or update.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 8 Jun 2016, 21:46 last edited by
      #2

      Hi and welcome to devnet,

      If you want to show tabular data in a tree representation, then you'll to write your own model that does the table to tree conversion.

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

      W 1 Reply Last reply 8 Jun 2016, 22:18
      0
      • S SGaist
        8 Jun 2016, 21:46

        Hi and welcome to devnet,

        If you want to show tabular data in a tree representation, then you'll to write your own model that does the table to tree conversion.

        W Offline
        W Offline
        WarOfDevil
        wrote on 8 Jun 2016, 22:18 last edited by
        #3

        @SGaist

        Thanks for the quick reply :)
        Could you please show me an example of how to do it? I tryed to google but i'm a bit confused.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          WarOfDevil
          wrote on 9 Jun 2016, 11:20 last edited by
          #4

          Nobody? I'm really stuck with this and i cannot continue.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 11 Jun 2016, 22:40 last edited by
            #5

            There's the Editable Tree Model example that shows you how a tree model should work. This should give you a good starting point.

            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
            • A Offline
              A Offline
              ael16
              wrote on 12 Jun 2016, 13:09 last edited by
              #6

              For a beginner I have found Youtube tutorials from VoidRealms very helpful. For example this tutorial is about editing in a database table:
              https://www.youtube.com/watch?v=LkbfNoZrTBQ&list=PL2D1942A4688E9D63&index=56 (C++ Qt 56 - QSqlTableModel )

              1 Reply Last reply
              0

              1/6

              8 Jun 2016, 16:56

              • Login

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