[Solved] Signal slot between two windows
-
I have two windows - one is the main program, I open a second window to get some data that needs to go back to the first window. When OK button is clicked I want to pass data via signal / slot.
But I can't figure out how to identify the main window from the primary, or the right way to reference the 2nd window and set it up from the main.
-
Maybe , you want something like this?
@
MainWindow
{
public slots:
void onChildOk(); //slot to receive signal from child
protected:
ChildWindow *pChild;
}ChildWindow
{
public slots:
void on_YourButton_clicked()//the slot to signal which emit when you click ok button
{
emit buttonClick; //send buttonClick signal to mainwindow
}
signal:
void buttonClick();
}
//Then call connect at the mainwindow . connect(pChild,SIGNAL(buttonClick()),this, SLOT(onChildOk()))
@ -
-
Thanks I got it
-
Please mark the title as "Solved", if it is solved :)