Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Close or hide window ? Which the best ?

Close or hide window ? Which the best ?

Scheduled Pinned Locked Moved Unsolved Language Bindings
python
3 Posts 2 Posters 3.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on 18 May 2017, 13:29 last edited by A Former User
    #1

    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):
            """Constructor."""
    
            super(TRANUSInterfaceVariationDialog, self).__init__(parent)
            self.setupUi(self)
            self.launch_btn.clicked.connect(self.launch_TRANUS_variation)
            
        def launch_TRANUS_variation(self):
            
            dialog = launch_variation_dialog.LaunchVariationDialog(self.folder,self.base_scenario.code,self.tranus_binaries,parent=self)
            #self.close()
            self.hide()
            dialog.show()
            result = dialog.exec_()
            
    
    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 18 May 2017, 13:32 last edited by
      #2

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

      ? 1 Reply Last reply 18 May 2017, 13:59
      2
      • ? A Former User
        18 May 2017, 13:32

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

        ? Offline
        ? Offline
        A Former User
        wrote on 18 May 2017, 13:59 last edited by
        #3

        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.

        1 Reply Last reply
        0

        2/3

        18 May 2017, 13:32

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved