QSqlRelationalTableModel - problem with non-existent rows



  • Hello.

    I have very big problem with my database application. If the main table contains foreign key which is set to NULL, the entire row is not displayed.

    My solution to the problem was to create a row in the relation's table called "None". When the user doesn't selects the link to relation's table (foreign key is not set) value is automaticlly set to default "NONE". Thanks to this the main table displays all available rows.

    For example: I have 3 tables:
    1.People
    2.Place
    3.Machine

    The place where the machine is set to "NONE"
    The place where the people is set to "NONE"

    The problem is in displaying a database VIEW which contains this 3 tables (also another): people, place and machine, becouse it looks like people have relations with machine. But it's not true. It looks like this becouse of the same place.

    Is possible to sublass QSqlRelationalTableModel for displaying rows of main_table which contains foreign key set to NULL???


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.