Results 1 to 8 of 8

Thread: how to get the pointer to parent widget/object?

Hybrid View

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

    Default Re: how to get the pointer to parent widget/object?

    Quote Originally Posted by rambo83 View Post
    In this case it is not possible, because I have already included the definition of class "Plot" into the header file of class "mainFrame", so that I cannot include the definition of class "mainFrame" into the header or cpp file of class "Plot"
    You can use a forward declaration!

    Qt Code:
    1. class mainFrame;
    2.  
    3. class Plot
    4. {
    5. public:
    6. Plot(mainFrame *mf = 0);
    7. //...
    8. };
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to Lykurg for this useful post:

    rambo83 (26th November 2009)

  3. #2
    Join Date
    Nov 2009
    Posts
    94
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: how to get the pointer to parent widget/object?

    Yes, you are right, Lykurg!

    I have just found something about forward declaration in Google and used it in my code and it works now! Thank you very much.

    best regards,

    Vitali

Similar Threads

  1. Dragging a pointer
    By Cruz in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2009, 04:51
  2. Replies: 6
    Last Post: 8th July 2009, 14:24
  3. get QMdiSubWindow Pointer of Current SubWindow
    By pospiech in forum Qt Programming
    Replies: 1
    Last Post: 26th June 2009, 05:40
  4. parent() heirarchy misunderstanding?
    By KShots in forum Qt Programming
    Replies: 2
    Last Post: 16th October 2007, 19:18
  5. get Parent Pointer
    By raphaelf in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2006, 14:09

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
  •  
Qt is a trademark of The Qt Company.