Results 1 to 9 of 9

Thread: Access variables of other classes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Access variables of other classes

    That is the reason why you declared your variables with "private" access specifier, so they can't be accessed/modified directly, only by their "public" getter/setter functions.

    LE: also notice that: Setts::set_ui->SB1->setValue(1); //most likely you tried that before constructing the actual object, set_ui is only a pointer... you construct your UI object in your class constructor... something like... set_ui = new UI_Class_Name(most likely 'this' as a parent); only after that you can do "stuff" to the UI pointer.

    When you use pointers you <need to> have two(2) objects, the pointer and the actual object that is "pointed to".
    Last edited by Zlatomir; 1st August 2010 at 13:07. Reason: lexical... 2

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

    przemek (1st August 2010)

Similar Threads

  1. Replies: 7
    Last Post: 11th April 2013, 10:55
  2. how to share variables
    By sksingh73 in forum Newbie
    Replies: 4
    Last Post: 2nd July 2010, 04:54
  3. environmental variables
    By mohanakrishnan in forum Newbie
    Replies: 4
    Last Post: 26th October 2009, 09:43
  4. How I get POST variables?
    By emental86 in forum Qt Programming
    Replies: 3
    Last Post: 27th March 2009, 17:19
  5. QPainter and how to access the parent variables.
    By Teuniz in forum Qt Programming
    Replies: 6
    Last Post: 7th March 2007, 14:06

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.