How can I operate ui widget in other CPP file?
Solved
Qt in Education
-
I have create a qwidget project.And in the widget.cpp,I can ues such statement as "ui->listWidget->addItem("Test! ");" to interaction with there UI widget,but in my own cpp file,i can not do this.So what is the right way to use UI widget in othe cpp file?
-
HI and welcome to devnet,
inside your class
ui
is private so you cannot access to it outside your class.
If you need to change something outside your class you have to define a public method that changes your UI and call it from outside your class.Usually you can to it also using signals/slots