Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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()));
     myDialog->show();
    

  • Lifetime Qt Champion

    Hi,

    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