Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to forbid arrows on keyboard in Qt project
Qt 6.12 LTS is out! See what's new in the release blog

How to forbid arrows on keyboard in Qt project

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.1k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I am doing a simple project a rotate cubic, and i have problem with arrows on keyboard and button.
    I have two buttons, when i clicked first button the cubic rotate to right,the second button is used to rotate to left and i have too two arrows on the keyboard, up and down, and theirs function is the same as buttons,when i press up arrow the cubic rotate right and so one.Problem is when i start the application,the arrows instead of control the rotate, they select the buttons.
    So i need to know where i can change the options or turn of control arrows to buttons

    Projet is made by inheriten QMainWindow

    Thank you for answers

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi,

      I think you have a problem with keyboard focus. Try to use "grabKeyboard":http://qt-project.org/doc/qt-4.8/qwidget.html#grabKeyboard on the widget you want to receive keyboard events.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved