Fix greedy completion for qtconsole

Fixes issue: Atuo-completer not working when set to greedy in qtconsole #6401