Search code examples
qtqtgui

Refresh QTableWidget with new values


I have two forms - form1, form2. form1 has got a QTableWidget which reads and shows xml entries in folder.

form2 is a dialog form, collect user data and save as xml.

I need to implement the following: Pressing button1 in form2 save (this is working) and close the window and immediately refresh QTabletWidget in form1 with new values.

Could you show me a way to implement this?


Solution

  • An easy workaround without signal & slot: close form 1(btw , it is QMainwindow) when form 2 is created. Then when I press button form 2 will be closed and a new form 1 will be created. Like this:

    this->close(); ---->form 2
    MainWindow *back = new MainWindow(this);
    back->show();