Simply emit a signal from the slot connected to the Ok button.

Then in your program connect a slot to this signal.