accessing .ui file from another C file
Hello Folks,
I have a question:
I have created a project in Qt, and created a gui.
so now i have the following:
headers:
mainwindow.h
myfunction.h
sources:
mainwindow.cpp
myfunction.cpp
forms:
mainwindow.ui
In my mainwindow.cpp, i call the function myfunction.cpp. And everything is fine and does what is suppose to do.
My question is:
I want to control and update some Qlabels in mainwindow.h, how can i do that ? I know i can control the GUI through mainwindow.cpp but can i do some updates through myfunction.cpp ?
Please kindly advice,
Re: accessing .ui file from another C file
Use signal/slot mechanism or getter/setter approach.
Re: accessing .ui file from another C file
Agreed. The GUI management should be restricted to a single class whenever possible. If you want another class to be able to update/read the GUI then send the appropriate data to/from the GUI management class using appropriate member functions.