Is the (QMainWindow*) needed here? I'd think it would do upcasting automatically.