Hi,
Please let me know how to access widgets in other dialogs?
Thanks in advance
Printable View
Hi,
Please let me know how to access widgets in other dialogs?
Thanks in advance
Easiest is to provide a pointer to the widget(s) in the dialog constructor and, for example, save the pointer in a member variable of your class which is derived from QDialog. This way all methods of your dialog class can access the widget(s).
Header file
Implementation file
Code:
m_otherWidget(myOtherWidget) { ... m_otherWidget->callWhateverMethodIsAccessibleFromThatWidget(); ... }
Ernst
Windows are just normal classes, so you can do it just like if you were accessing data stored in some other class.
Remember that usually you don't want to access other window's widgets directly, since it's an implementation detail that should be hidden from other classes.
Also read this: http://www.qtcentre.org/forum/f-newb...gobj-4444.html and search the forum before you ask a question.