Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Key_Space event problem

    General and Desktop
    2
    2
    1667
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Minz last edited by

      Hi everyone, i'm developing a typing tutor application, on one of my widgets i have a QTextBrowser and some QPushbuttons for the keyboard layout. I implement keyPressEvent such that when a user types the text browser is updated, however when i push the space button one of the QPushbuttons on the keyboard layout is catching the event. I've tried @setFocusPolicy@ but it doesnt seem to work. Help would be much appreciated.

      1 Reply Last reply Reply Quote 0
      • C
        ChrisW67 last edited by

        You need to put the focus somewhere other than a QPushbutton or pressing space (maybe enter) will trigger it. Normally users would type into a QTextEdit and it would have the focus but you seem to be avoiding that. If you cannot place the focus elsewhere then you should be able to install an event filter on the QPushButtons (either from outside or by subclassing) and block Qt::Key_Space keyboard events for that button.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post