Important: Please read the Qt Code of Conduct -

[SOLVED] Insert data from dialog to Sql when clicked Ok button

  • I have dialog with manually crafted form for data. I want to insert this data into database and after that emit "accepted" signal to update sql views(do i really have to do it manually after all model changes?). What can I override to do in right order?
    I have code which do what i want. Where should i put it?

    Here is how I call dialog:

    myDialog = new MyDialog(this);
     connect(myDialog, SIGNAL(accepted()), this, SLOT(update_sql_views()));

  • Lifetime Qt Champion


    You would usually use QDataWidgetMapper for such a use case. There's the related examples that show how to do it.

    Hope it helps

Log in to reply