Results 1 to 5 of 5

Thread: Calling a method to a parent window/widget

  1. #1
    Join Date
    Aug 2010
    Posts
    30
    Thanks
    2

    Default Calling a method to a parent window/widget

    Hi,

    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

    Thanks
    Nathan

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Calling a method to a parent window/widget

    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.

  3. #3
    Join Date
    Oct 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Calling a method to a parent window/widget

    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
    Last edited by Vaffel; 6th November 2010 at 16:03. Reason: regret comment

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Calling a method to a parent window/widget

    Maybe a good idea to add this to a wiki page?

  5. #5
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Calling a method to a parent window/widget

    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.

Similar Threads

  1. error calling method using connect
    By jeffmetal in forum Newbie
    Replies: 4
    Last Post: 22nd April 2010, 18:09
  2. Replies: 5
    Last Post: 21st April 2010, 21:36
  3. Replies: 6
    Last Post: 3rd September 2008, 14:27
  4. Calling same method from separate threads
    By steg90 in forum Qt Programming
    Replies: 2
    Last Post: 19th July 2007, 08:55
  5. Replies: 4
    Last Post: 10th March 2007, 18:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.