Two comments re your code:
1) What do you think happens to "plot" when on_pushButton_clicked() ends?
2) Using setRawSamples() presents the same problem as item 1. From the Qwt docs:setRawSamples is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerData class.
Bookmarks