I am new to QT, writing the first “training” project on it. I want to display a list of objects in the table. That is, one line is one object. At the same time I want to be able to select any line and delete it if necessary. Table cells should only display data (read only), and the data should be processed in a dialog box, which will contain data from the selected row.
There is a list of objects of the class Person. Person consists of QString'ov and Integer'ov (data such as name, surname, age, etc.). WPF has such a cool thing like binding with which you can easily display such lists here ...
I understand that using QtTableWidget I will have to loop through all the elements of the list and manually enter the necessary data from an object of type Person into each cell. But somehow I do not really like this decision. Already a lot of code is obtained.
Reading the documentation, I noticed that there is some possibility to create a ViewModel / Model / Template for the class I need, which would actually be very convenient, because then you wouldn’t have to manually enter the data into the cells each time, but you could pass the table just an object of type Person and She herself would understand what property of this object in which cell to insert. During the hours of reading forums and QT documentation I didn’t understand whether there is such a possibility or not, and if there is, how does it work (I didn’t find tutorials)?
Now the questions in order:
- Which QT-Widget is best suited to display a list of objects (more precisely, the properties of these objects)?
- Is it possible to create an analog WPF'no ViewModel in QT?
- If there is such a possibility, is it possible to link to a tutorial or a short explanation / example?
PS Forgive me for writing something very messy, I tried as best I could. If something is not clear, ask.