Exemplo n.º 1
0
 def char_selected(self, c):
     if QApplication.keyboardModifiers() & Qt.CTRL:
         self.hide()
     if self.parent() is None or self.parent().focusWidget() is None:
         QApplication.clipboard().setText(c)
         return
     self.parent().activateWindow()
     w = self.parent().focusWidget()
     e = QInputMethodEvent('', [])
     e.setCommitString(c)
     if hasattr(w, 'no_popup'):
         oval = w.no_popup
         w.no_popup = True
     QApplication.sendEvent(w, e)
     if hasattr(w, 'no_popup'):
         w.no_popup = oval
Exemplo n.º 2
0
 def char_selected(self, c):
     if QApplication.keyboardModifiers() & Qt.Modifier.CTRL:
         self.hide()
     if self.parent() is None or self.parent().focusWidget() is None:
         QApplication.clipboard().setText(c)
         return
     self.parent().activateWindow()
     w = self.parent().focusWidget()
     e = QInputMethodEvent('', [])
     e.setCommitString(c)
     if hasattr(w, 'no_popup'):
         oval = w.no_popup
         w.no_popup = True
     QApplication.sendEvent(w, e)
     if hasattr(w, 'no_popup'):
         w.no_popup = oval