Close or hide window ? Which the best ?

  • Hello,

    I have a window when clicked on a button launches another window. I want to close the first window and to show only the second window.
    I tried close and hide methods and they work both for me but I want to know which the best and what is the difference between the two methods.
    Here is my code :

    class TRANUSInterfaceVariationDialog(QtGui.QDialog, FORM_CLASS):
        def __init__(self,project,parent=None):
            super(TRANUSInterfaceVariationDialog, self).__init__(parent)
        def launch_TRANUS_variation(self):
            dialog = launch_variation_dialog.LaunchVariationDialog(self.folder,self.base_scenario.code,self.tranus_binaries,parent=self)
            result = dialog.exec_()

  • Hi! hide keeps the window object in memory, so you can show it again later. close destroys it.

  • Hello @Wieland,

    In my case, I am integrating my interface as a plugin in QGIS. So, when closing all the windows and launching from QGIS, the main window is displayed. I don't really know If I need to destroy in this case.
    Thanks for your reply.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.