I am also getting the same error while trying to set the widget from the function to QDockWidget. Did you get any solution for that ?

Regards
Abhinav