I have written a project which includes a mainwindow
and a replacedlg.ui
. I want to use replacedlg.ui
in mainwindow.cpp
.
I'd like to write things like ui->button
in mainwindow.cpp
, but I can't.
Who can help me make this work?
I have written a project which includes a mainwindow
and a replacedlg.ui
. I want to use replacedlg.ui
in mainwindow.cpp
.
I'd like to write things like ui->button
in mainwindow.cpp
, but I can't.
Who can help me make this work?
Don't try to share the
ui
variable between classes. It is bad design. Instead add methods in your classes which will let you do what you need to do.In your case where you want to send the text of your line edit from
replaceDlg
class to yourMainWindow
class, you should use signals and slots. Here is an example: