def focusChanged(lostFocus, hasFocus): hasFocusType = type(hasFocus) if hasFocus is None or hasFocusType != X11Embed: # for e.g. focus is out from application, or is another widget keyG = QWidget.keyboardGrabber() # find keyboardGrabber and releaseKeyboard if keyG is not None: keyG.releaseKeyboard() elif hasFocusType == X11Embed: hasFocus.grabKeyboard()
def focusChanged(lostFocus, hasFocus): hasFocusType = type(hasFocus) if hasFocus is None or hasFocusType != X11Embed: # for e.g. focus is out from application, or is another widget keyG = QWidget.keyboardGrabber( ) # find keyboardGrabber and releaseKeyboard if keyG is not None: keyG.releaseKeyboard() elif hasFocusType == X11Embed: hasFocus.grabKeyboard()
def leaveEvent(self, event): keyG = QWidget.keyboardGrabber() if keyG is not None: keyG.releaseKeyboard() event.accept() # needed?