Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Call function from one form in another
I have a function that generates values in one form. Now i want to call that function on a second form to display on the second ui. Can anyone tell me if there is a method to do this?
Can anyone tell me if there is a method to do this?
The correct method in Qt are signals/slots: https://doc.qt.io/qt-5/signalsandslots.html
Connect signal from first form to a slot in second form. And emit the signal in first form if it generated something.
Will try this and let you knwo.
sambills Banned last edited by
This post is deleted!
Not being able to connect. Have tried how much I could, but not being able to figure it out. Could someone help, please.
JonB last edited by JonB
Show code attempt.
At the end of the day won't it be:
connect(form1_instance, &form1_signal, form2_instance, &form2_slot);
You will need to write that code in a module which includes both
form2.h. That might potentially be either
form2.cpp, or perhaps you have a
mainwindow.cppwhich includes both