@SpaceToon said in Is it possible to receive a signal from a class that was instantiated twice?:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindowA m;
m.show();
return a.exec();
}
Where is your MainWindowB instance create? Does MainWindowA do this somewhere?
In general, I would expect something along these lines in main:
int main(int argc, char *argv[]) { QApplication a(argc, argv); emitSignalClass emitter; MainWindowA mA(&emitter); mA.show(); MainWindowB mB(&emitter); mB.hide(); return a.exec(); }Create an instance of your signal-emitting class first and hand it to the constructurs. Store a pointer to the same emitter object as member variable in both MainWindowA and MainWindowB.