Re #7950. More changes for PyQt API change.

This is exactly the same change in several places. Previously the
toPyObject() turned the returned QVariant into the desired type.
Now the actual type is returned in the first place.