Results 1 to 5 of 5

Thread: [Question] Is it possible to access a class member from another class?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [Question] Is it possible to access a class member from another class?

    You need to learn about encapsulation. Even though class 1 could access class 3's QLineEdit, it shouldn't. Class 3's QLineEdit should be local to and accessible by Class 3 only.

    Instead, what should happen is that when you press the button, Class 3 will put the text into its QLineEdit, and then notify Class 1 that it has a filename via a signal. Class 1 will then do it's job.

  2. #2
    Join Date
    May 2010
    Location
    Rousse, Bulgaria
    Posts
    25
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Question] Is it possible to access a class member from another class?

    Thank you for your replies, I'm going to find some literature about this and study it in-depth.

  3. #3
    Join Date
    May 2010
    Location
    Rousse, Bulgaria
    Posts
    25
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Question] Is it possible to access a class member from another class?

    I've completed my application successfully thanks to your help! I appreciate it very very much!

Similar Threads

  1. Using a static member in a class
    By feraudyh in forum Newbie
    Replies: 4
    Last Post: 29th April 2010, 10:58
  2. Class member reference
    By waynew in forum Newbie
    Replies: 2
    Last Post: 20th December 2009, 01:38
  3. A class member has ran away?!
    By MIH1406 in forum Newbie
    Replies: 4
    Last Post: 24th August 2009, 23:21
  4. Using a QMutex as a static class member
    By emostar in forum Qt Programming
    Replies: 2
    Last Post: 15th June 2009, 13:48
  5. Replies: 5
    Last Post: 14th July 2006, 22:42

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.