Version 1 of the PyQt APIs return QVariant types that must be cast to Python strings before use. To catch this `get_window_title()` in `backend_qt5.py` wrapped the call to `self.window.windowTitle()` with `str()`. This fails on Python 2 if the window title contains unicode characters. This is replaced with `six.text_type` for Py2&3 compatibility with unicode types. A number of other locations in the same file were also using `str()` for potentially unicode data. These are also fixed in this commit. Fixes #4275.