Then set the focus policy either Qt::ClickFocus or Qt::StrongFocus using setFocusPolicy();

If this also doesn't work use eventHandler() .