Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    GrabKeyboard troubles

    General and Desktop
    1
    2
    983
    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.
    • W
      wisellers last edited by

      I have a main window with a big OpenGL widget that I manipulate 3D objects in. Some of this manipulation is done with keyboard presses so I grab the keyboard in enterEvent and release it in the leaveEvent. This is fine but I also have floating tool bars and dialog boxes that pop up over the big widget. None of the controls (QTextEdit and QSpinBox widgets) get any keyboard input any more - presumably because the mouse is still within the OpenGL widget and so no leave event has been generated. Is there another event I should be trapping to release the keyboard to get all these controls to work as expected when widgets overlap? Perhaps I could do it by trapping QEvent::CursorChange but that seems a bit of an ugly hack. QEvent::WindowBlocked should work for for the dialogs.

      Cheers
      Bill

      1 Reply Last reply Reply Quote 0
      • W
        wisellers last edited by

        I've got around this by subclassing the QTextEdit and QSpinBox classes so they send enter and leave signals which I can use to grab and ungrab the keyboard. It still isn't at all neat, and not 100% reliable which surprises me. Am I always guaranteed that each enter event will be paired by a leave event?

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