Results 1 to 3 of 3

Thread: declaring a friend

  1. #1
    Join Date
    Feb 2006
    Posts
    26
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    MacOS X Windows

    Default declaring a friend

    Hi,
    Is it possible to declare a friend class between two dialogs without having to subclass them?

    Thanks for any help,
    Jay

  2. #2
    Join Date
    Feb 2006
    Posts
    15
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: declaring a friend

    Good Evening (where I am),

    I presume you wish to do this in Designer. In the Object Explorer, make sure you choose the dialog which is going to grant access. Go to the Members tab and down to 'Class Variables'.
    Add a "new variable" in public or protected (I don't believe it matters) that looks something like this:
    Qt Code:
    1. public:
    2. friend class OtherDialogClass;
    To copy to clipboard, switch view to plain text mode 
    where "friend class OtherDialogClass" is the variable name. This should work fine.

    Cheers,

    Math

  3. The following user says thank you to Honestmath for this useful post:

    jayw710 (18th April 2006)

  4. #3
    Join Date
    Feb 2006
    Posts
    26
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    MacOS X Windows

    Default Re: declaring a friend

    Thank you. Worked like a charm!

    Jay

Similar Threads

  1. problem in declaring QDirModel
    By prasanth.nvs in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 11th December 2008, 17:45
  2. friend class in TC++ book
    By mickey in forum General Programming
    Replies: 11
    Last Post: 25th August 2008, 23:08
  3. QTextBrowser and friend function
    By probine in forum Qt Programming
    Replies: 4
    Last Post: 14th December 2006, 18:03
  4. how to declare a friend variable ?
    By probine in forum General Programming
    Replies: 5
    Last Post: 27th March 2006, 16:00

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.