The easiest way: In Qt Creator's UI designer, right-click a widget, click "Go to slot...", select a slot (eg. clicked() for a button), and it generates what you need where it needs to be.
I did, but the whole point is that user must not close it, I mean I don't want to give user opportunity to close it. Just show him a message that something is being done and all he can do is wait