Best multiple selection method
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?
How will the values of these multiple selection be stored into the database ?
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?
So you are going to change the schema of your database ? Or is it at the creation time ?
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.
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 ?
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.