Important: Please read the Qt Code of Conduct -

disabling all keyboard input to a dialog

  • So I'm not really interesting in the reasons why this may or may not be a good idea...I have a use case where I navigate the dialog by mouse, and keys normally associated with dialog navigation are shortcutted to custom UI child widget invocation: up/down/left/right/pg-up/pg-dn need to ONLY DO what I make them do via a KeyReleaseEvent override. The UI is realized in the class as follows:

    self.ui = Ui_Output()

    The observed behaviour is that both my override AND the built-in dialog navigation functions are being executed. I want ALL dialog keyboard navigation functions disabled for the dialog and its child widgets! Only my KeyReleaseEvent handler should process keyboard input. The mouse must continue to function on available widgets. I cannot have right-right-right key sequence move focus to the dialog slider, where it is captured and (interpretted) by the slider widget, as an example.

    A flavor of this question was asked back in 2012 with no answers posted.

    How can I (with one fell swoop) disable keyboard navigation for my dialog and all its children?

  • @Kent-Dorfman
    +1 for your command of the English language to (correctly) use "one fell swoop", and not the spelling so often found which refers to football or chickens... :)

    In a single word, is the way to achieve your desired behaviour by defining an eventFilter() on the dialog, where you can select which events to handle/pass on and which to ignore?

Log in to reply