I have a Qmainwindow that has several buttons, which when clicked, open other windows. When one of these sub windows is closed using the red X, I would like to set focus to a particular QLineEdit in the main window, which remains open. I do not want to do any processing in the sub window when it closes, but simply want to do something in the still-open main window. So far:
In one of the sub windows, in the init, I have:
self.closeEvent(self.mainWindow.reset_focus)
self.closeEvent(self.mainWindow.reset_focus)
To copy to clipboard, switch view to plain text mode
In the mainwindow, I have:
def reset_focus(self):
self.ui.xyz.setFocus()
self.ui.xyz.selectAll()
def reset_focus(self):
self.ui.xyz.setFocus()
self.ui.xyz.selectAll()
To copy to clipboard, switch view to plain text mode
I thought I could just set up an event handler in the init of the sub window, but the above does not work. I've read:
https://www.qtcentre.org/threads/610...=close%20event
in this forum, but cannot determine how to translate to my situation, nor can I read the C code.
Bookmarks