What about moving variables from private to public? :P
What about moving variables from private to public? :P
I tried, without results![]()
Use getter and setter methods. Also search the forum, there are hundreds post of that topic.
Thanks Lykurg, but I have question. Is it alone way to use getter and setter methods? Is not possible to access variable without extra methods?
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
przemek (1st August 2010)
Sorry for double post... I edited (corrected) the last one a little bit, and a little advice
Most likely, the setter functions you will want(need) to declare as slots, so that you can connect (other objects) signals to them.
You can also use events or signals and slots.
I attached the sample project (as i promised)
I used signals and slots and created some signals and slots for keeping the ui pointers private (you can do that, or you can inherit from both the ui_generated class and QDialog, QMainWindow or QWidget) i like (and use most) the private pointer member and code what signals and slots i need.VariablesUpdate.zip
Bookmarks