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. Best multiple selection method
Forum Updated to NodeBB v4.3 + New Features

Best multiple selection method

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 2.0k Views 2 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
    MR_mn
    wrote on last edited by
    #1

    Hello,
    I’m still experimenting with databases (sqlite), as you can see my previous thread.
    Right now I’m implementing a ui which lets the user create a new record in a database table, and populate it with some data from line edits in the designer; at the end, a “save” button will create the new record in the database table.
    The issue I’m trying to solve is that, other than line edits, I’d like to add multiple selection boxes, from which the user can select more than one property.

    These properties will then be saved in the database.

    My first idea was to put checkboxes, but I’m not sure that is the right path to follow.
    I tried to search the forum for some questions like mine, but I couldn’t find anything.

    Is there anyone willing to give me some hints or pointing me out in the right direction?

    Thanks,
    M.

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

      Hi,

      How will the values of these multiple selection be stored into the database ?

      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
      1
      • M Offline
        M Offline
        MR_mn
        wrote on last edited by
        #3

        The idea is, if the user selects N values, that the code creates N columns in the table and puts the selected values in those columns - could that work?

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

          So you are going to change the schema of your database ? Or is it at the creation time ?

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

          M 1 Reply Last reply
          1
          • SGaistS SGaist

            So you are going to change the schema of your database ? Or is it at the creation time ?

            M Offline
            M Offline
            MR_mn
            wrote on last edited by
            #5

            Changing the schema of the database, as the user needs to be free not to select any property if no property is applicable in a certain scenario.

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

              Hi
              If user can change the schema, its not really edit record , but add table you allow them.

              So user will define the table layout and then he can put in values ?

              1 Reply Last reply
              1
              • M Offline
                M Offline
                MR_mn
                wrote on last edited by
                #7

                I'll try to explain a little bit more what I'm trying to achieve.

                Basically I'm trying to create a program which manages equipment & related maintenance.
                There will be many Windows, one of them will let the user "create" a new equipment, defining some basic data which can be directly put by the user itself (for example S/N, model, description, etc..) and for which I'm using lineEdit.
                Some other caharacteristics will be chosen from a SQLITE database (for example, the "name" of certain components attached to the equipment and that are unique, and with this I'm fine, I created a comboBox which links to a SQLITE database).
                Some other data, on the contrary, are not unique (for example, certifications): the user needs to be free to select either nothing or more than one type of certification for that equipment.
                Rethinking of what I wrote, maybe the best way would be to create the relative columns in the database, and when the user selects a certain certification (or no certifications at all), the corresponding column will be populated with a certain value (which could be the name of the certification itself).
                At the bottom of the window, there are two buttons, save and cancel, cancel actually closes the window and save (which I haven't implemented yet) should be used to save all the user selection.
                I hope I'm clear now, if you want, I can post the code for this particular window.

                Thanks
                M.

                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