View Full Version : Calling a method to a parent window/widget

6th August 2010, 15:24

I have an application that creates a dialog window, does some processing, then closes to return to the main window.

I want to know how to 'invoke' a method call to the main parent window when this dialog closes. I should note that the main window and dialog are in separate classes.

Are then any signals I should look at? If so, how would I connect the two classes with this signal.
Or, a static method, perhaps? - I'm trying to avoid static methods if possible


6th August 2010, 15:27
Here we go again. We had this question a thousend times. Two times last week. So please se our search function to find the answers. If you have a more specific question. please ask again.

6th November 2010, 14:25
Well, I was wondering the same thing. I searched for it and found nothing, just endless threads with no relevance.

EDIT: Ok, Now actually found a useful thread... not always easy to find the "right" searching keys in a forum matching words that other people have used that are just as novice as your self.

I actually found out that my cast:( (MyParentClassName*)parentWidget() )->method(...)
was working but my problem was of some other uninteresting sort eleswhere.

Thanks :)

6th November 2010, 14:42
Maybe a good idea to add this to a wiki page?

6th November 2010, 15:52
Short answer: your dialog shouldn't emit signals of this sort. You're embedding specific application logic into the dialog, which will hinder reuse in the future.

Whatever method is displaying the dialog should emit an appropriate signal when the dialog returns. This keeps application code where it belongs, and allows tailoring of emitted signals based on the dialog's return value.