Qt World Summit: Submit your Presentation

Two full functional QSqlRelationalTables, problem with adding a record

  • Hello,

    I'm writing a program for my mother which she can use to track the storage at her company.
    For this I want to make a QDialog with two relational table models. In one model are the orders from the employees, which has a relation to the employee. In the other table the products that were ordered in that exact order. The order table is fully functional,
    I can add orders and edit all the orders. The relation to the second model works too, if I select a order I get the appropriate products in the other model.

    Now I'm trying to have a button that adds a product to the product model, but I can't it too work. The interpreter tells me:
    edit: index was invalid
    edit: editing failed

    Also the new record does not show up on relational table model. When i look with a sqlite database manager the records have been added and the product_id is set to NULL as I want it.

    Hope someone can help me get this working.

    Code was too large for this forum, so you can find it here: http://pastebin.com/amQEpavB

    Thanks in advance.

Log in to reply