is there any way to restore the GUI to same state after QMainWindow->GUI
Unsolved
General and Desktop
-
Hi have
I have QT GUI , which I close by usign QMainWindow->close . As per the documentation of QMainWindow close hide the GUI . but I am not getting a direct where I can unhide the GUI to same stateRegards
Roshni -
Call widgets show slot.
mainwindow->show();
http://doc.qt.io/qt-5/qwidget.html#show -
@Qt-Enthusiast
I believe the default atribute of QMainWindow is set withQt::WA_DeleteOnClose
that means when you close your mainwindow it also gets deleted and theres no way to just show it again. WidgetAttributesIn your case, the easiest way is to simply call
QWidget::hide()
andQWidget::show()
-
Try with simple example like this.
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();QPushButton b1("Close"); QPushButton b2("Show"); QObject::connect(&b1,SIGNAL(clicked()),&w,SLOT(close())); QObject::connect(&b2,SIGNAL(clicked()),&w,SLOT(show())); b1.show(); b2.show(); return a.exec();
}