How to pass UI Form object to another class?
Unsolved
General and Desktop
-
Hello @kenyanke ,
If you want access the UI object in other class. First include header file(if you created ui file with class and header)and ui file in main.cpp#include ui_sugarviewuifile.h
#include sugarview.hand then
ui_sugarviewui.> access all objects in the ui file/QForm name; -
hi
normally you would not allow directly accesses to UI class from outside
as then all of the program know you have a QFrame in there.The better way is simple to create public function
that sets the data u need in the class that owns
the UIsay like
public:
SetSugarViewData( QString Name );and in cpp you implement it and there u can use
ui->SugarViewThen main will talk to "sugerview" via the public functions and has no need to have access to UI->
directly.