Slight misunderstanding on how QDialog works