When launching a class the second window has no contents:
QWidget* w = new demo2();
w->show();
The target has:
demo2::demo2()
{
QVBoxLayout* layout = new QVBoxLayout;
button2 = new QPushButton( "demo2" );
layout->addWidget(button2);
//connect( button2, SIGNAL( clicked() ), demo1, SLOT( fromDemo2() ) );
The button does not show up but a blank window does.
If the connect instruction is uncommented the compiler
complains about demo1 "error: expected primary-expression before ‘,’"
I tried several variations, but could not get it to work.
Solved. To get the display I needed to add setLayout(layout); in demo2.cpp.
To solve the connect issue I had to turn it around so when class demo2 is instantiated in demo1.cpp: