PDA

View Full Version : Cancelling an Object Creation



bbad68
4th March 2010, 20:12
Hi,

My program generates a 3d model in a qvtkWidget when the 'Generate' button in one of the dialogs of the main window is clicked. During the creation of the model, a QProgressDialog appears. When the 'Cancel' button in the QProgressDialog is clicked, the model and the object pertaining to it are deleted, as desired, however the program crashes. I think that the problem is that after the model is deleted, the program returns to where it was in the code the instant that the 'Cancel' button was clicked, calling methods whose classes were just deleted. How can I get the program to reset to the where it was before the 'Generate' button was clicked?

I hope this makes sense :p

Lykurg
4th March 2010, 20:22
How do you stop the creation and how do you delete the "created" widgets? Maybe deleteLater() fits your needs. Also make sure you don't access a pointer to the widget you just have deleted. But therefore we have to see more code on how you stop the creation etc.