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. Can i input data to the database using a table?
Forum Updated to NodeBB v4.3 + New Features

Can i input data to the database using a table?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.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.
  • P Offline
    P Offline
    pkjag
    wrote on last edited by
    #1

    So i know that forms are used to input data to a database. Is there any way i could use a tablewidget or a tableview to input data? The table has the columns set so i only have to add the records i.e create new rows and enter corresponding data, and then the usual database process of submitting and outputting the data is also included.

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

      Hi,

      Please don't post the same thread multiples times

      "Duplicate":http://qt-project.org/forums/newreply/32802/

      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
      • P Offline
        P Offline
        pkjag
        wrote on last edited by
        #3

        So i created a new thread by editing the previous one, is this allowed??

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

          AFAIK, it's not forbidden.

          As for your current question, have a look at QTableView and QSqlTableModel, that should give you a good start

          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
          • P Offline
            P Offline
            pkjag
            wrote on last edited by
            #5

            i can only think of
            @
            QList<QCheckBox*>allcheckboxes = findChildren <QCheckBox*>();

            //then try

            allcheckboxes.text(i);

            //to extract the label of the checkbox at index i
            @
            i don't know if this is allowed but its all i've got right now and i could really use an example because i have no idea what to do???

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

              If you want to go with findChildren you will have to iterate through allCheckBoxes.

              @QStringList labelTextList;
              foreach (QCheckBox *checkBox, allCheckBoxes) {
              if (the_test_you_need) {
              labelTextList << checkBox->text();
              }
              }
              return labelTextList;
              @

              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

              • Login

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