0

I would like to use a button_clicked slot to reset all the widgets used in the application. I tried calling the function used in the application constructor, which is present by default when you create an ui application project in Qt.

ui->setup(this).

I called the same in the pushbutton_clicked() slot function. For example -

void MyMainWindow::on_pushButtonLdDefaults_clicked()
{
    ui->setupUi(this);
}

This gives me the expected result, all the widgets get reset. But after this, all the buttons and widgets become unresponsive. No events are heard after this. Am i doing something wrong by calling ui->setup(this)?

Also, If there is any other way to easily reset the widgets, please share.

Ranju
  • 11
  • 4
  • The setup() function creates objects by separating memory, so you should not use that function to reset. – eyllanesc Jan 05 '17 at 04:26
  • Ah ok! Thanks. Found another solution here to restart the whole app, which servers my purpose (kind of). [Restart_Application](http://stackoverflow.com/questions/5129788/how-to-restart-my-own-qt-application) – Ranju Jan 05 '17 at 06:48

0 Answers0