You could make the line edit a focus proxy of the canvas. Mouse input is not really related to focus but rather with activation. On some systems this is the same, on others this differs. Try the focus proxy or set the focus policy of the canvas to NoFocus.