Problems suppressing keystrokes when connecting QCompleter to Q



  • Hello all,

    I am attempting to use QCompleter connected to a (subclass of) QTextBrowser. Everything works as expected, except that I have had no joy suppressing entering of keystrokes into the QTextBrowser when the QCompleter is active. This is a show stopper.

    My apps standard event filter properly catches the key events (event.type is event.ShortcutOverride). Alas, setting event.accept() does not cause they keys to be ignored later: the keys appear in the QTextBrowser. In contrast, setting event.ignore() (for the up and down arrow keys) does cause the QCompleter to recognize those keys and treat them as usual.

    Similarly, having the event filter return True does not cause the QTextBrowser to ignore the keys. This looks like a bug in the interaction of QCompleter and QTextBrowser.

    Can anyone suggest a way forward? Thanks.

    Edward

    P.S. The Python init code I use is:

    cpl = self.completer = QCompleter()
    cpl.setWidget(self.body) # self.body is a subclass of QTextBrowser
    cpl.connect(cpl,QtCore.SIGNAL("activated(QString)"),completion_callback)
    

    EKR


Log in to reply
 

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