Access gui elements of other classes
-
Hello,
My situation is the following:I have a dll lib that contains a MainWindow and about 10 programs that are derived from this MainWindow to add specific toolbars etc. So the general layout (menubar, toolbar on top) is the same for every program.
I want to create a class that is able to access GUI-elements of the MainWindow and the derived classes at the same time. How is this possible?
-
Hi,
There is about only one way to do that, make your GUI elements public, but you should NEVER EVER DO THAT!! The only safe way is to use setters/getters.
Gr -
What about your GUI-Controller class emit some signal, and your Window classes are connected to it ?
Or,
try the meta object way : http://qt-project.org/doc/qt-5.0/qtcore/qmetaobject.html#invokeMethod
-
So, in basic setter/getter functions using signal/slots or meta objects.