Cherry-picked pyside_support changeset from c86c6b8a to master.