20200111 two switching windows

Implemented entirely in the form of code, two windows, a child window of the main window, the window needs to add another child QWight class inheritance QWight be selected when adding such newly added cpp will be omitted in some

The main window class object need to include the sub-window, click on the button in the main window sub-window show () can, but need to use the sub-window signal transmission manner, to send information to implement the main window of the main window sub-window button press

.h affirmed the child window  

signals:
void mysignal (); 

groove subwindow button call:
emit mysignal (); signal is sent 

in the constructor of the main window, binding:
QObject::connect(subw,SIGNAL(mysignal()),this,SLOT(doprocess2()));  
doprocess2 implemented actions to receive signals 

Note:
Parameters QObject :: connect the easy wrong, four parameters, some parameters of the function name wrong compiler will not complain

Guess you like

Origin www.cnblogs.com/liujunsblocg/p/12183395.html