Complete qtconsole PyQt5 port

This completes the work of PR #5458 to make qtconsole work with PyQt5. To test it you need to cd into your fork, checkout this branch and run:

`QT_API=pyqt5 python3 -m IPython qtconsole`

If `QT_API` is not set explicitly, IPython chooses Qt4 first.

~~There is still an error when opening new tabs, so please don't merge it yet. I'm investigating how to fix it.~~

Closes #6103