Hi,

just call

Qt Code:
  1. curve->detach(); // regain ownership from plot
To copy to clipboard, switch view to plain text mode 

first, then you can delete it.

d_stranz is correct about not calling delete on an object that triggered a slot, but in this case the curve did not trigger the slot (but an arbitrary button instead) so you're free to delete the curve right away.

Tipp: prefix/suffix your member variable 'curve' like 'm_curve' so that you know it's a member variable.