I have a simple app with some amount of spinComboBoxes, pushButtons and other elements which can have Focus. App is a single window derived from QWidget and i want it to respond to pressing on arrow keys on keyboard. I tried to do it by reimplementing void keyPressEvent (QKeyEvent * event) function in my main window class and first I set focuses on all elements on Qt::NoFocus, or Qt::ClickFocus because they attract focus from arrows.

Qt Code:
  1. void PicDevWindow::keyPressEvent(QKeyEvent *event)
  2. {
  3. if(event->type() == QEvent::KeyPress)
  4. {
  5. QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
  6. qDebug() << "Ate key press" << keyEvent->key();
  7.  
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 

I don't understand why when no qui element has fucus i can't get QKeyEvent from arrows, i get key events from most keys on keyboard but not arrows. When i set focus on element like QLineEdit by clicking on it I can get key event from up and down arrows, hmmm but still don't understand how it works.
Shouldn't it give me all key events from my main window when i define above function in its body?