blups0r
8th June 2011, 23:18
Hey there,
I've got an issue with QSqlRelationalTableModel. I have an PostgreSql database with some tables like Customer and other related stuff. In the table Customer i have foreign keys to other tables. But this keys are not always set with valid values. Now when i use QSqlRelationalTableModel->setRelation and execute the select method i dont get all the entrys in the table. Is there a way to get all the entrys with the select method even though not all foreign keys are set?
I have thought of subclassing QSqlRelationalTableModel or QSqlQuery or QSqlTableModel is this the right approach or should i take a other way? The other Problem i've got is that the data which is stored in the model is more than i want to display. Is there a way to display only the collums i want? Lets assume the table customer has the collums firstname, lastname and age. Now i want the view that it only displays the firstname. The other values should be in the model but not visible to the user. How can i achieve this? Do i have to subclass the QAbstractItemView or is there another way? Maybe subclassing QSqlRelationalDelegate?
I hope you can help me.
Thanks in addvance
I've got an issue with QSqlRelationalTableModel. I have an PostgreSql database with some tables like Customer and other related stuff. In the table Customer i have foreign keys to other tables. But this keys are not always set with valid values. Now when i use QSqlRelationalTableModel->setRelation and execute the select method i dont get all the entrys in the table. Is there a way to get all the entrys with the select method even though not all foreign keys are set?
I have thought of subclassing QSqlRelationalTableModel or QSqlQuery or QSqlTableModel is this the right approach or should i take a other way? The other Problem i've got is that the data which is stored in the model is more than i want to display. Is there a way to display only the collums i want? Lets assume the table customer has the collums firstname, lastname and age. Now i want the view that it only displays the firstname. The other values should be in the model but not visible to the user. How can i achieve this? Do i have to subclass the QAbstractItemView or is there another way? Maybe subclassing QSqlRelationalDelegate?
I hope you can help me.
Thanks in addvance