Alarm *a = new Alarm(file);
alarmList.insert(a->objectName(),a);
ADisplay *display = new ADisplay(this); // other class
connect(a,SIGNAL(soundAlarm(Alarm*)),display,SLOT(showDisplay(Alarm*))); // when its time I call display
connect(display,SIGNAL(quiting()),a,SLOT(quiting())); // when display is closed call Alarm's quiting() slot (custom) that then:
connect(a,SIGNAL(quiting(Alarm*)),this,SLOT(remActiveAlarm(Alarm*))); // emit's the quiting() signal passing back to this class the
// object to delete which is:
remActiveAlarm(Alarm *a){
alarmList.remove(a->objectName());
a->disconnect();
delete a;
}
Alarm *a = new Alarm(file);
alarmList.insert(a->objectName(),a);
ADisplay *display = new ADisplay(this); // other class
connect(a,SIGNAL(soundAlarm(Alarm*)),display,SLOT(showDisplay(Alarm*))); // when its time I call display
connect(display,SIGNAL(quiting()),a,SLOT(quiting())); // when display is closed call Alarm's quiting() slot (custom) that then:
connect(a,SIGNAL(quiting(Alarm*)),this,SLOT(remActiveAlarm(Alarm*))); // emit's the quiting() signal passing back to this class the
// object to delete which is:
remActiveAlarm(Alarm *a){
alarmList.remove(a->objectName());
a->disconnect();
delete a;
}
To copy to clipboard, switch view to plain text mode
Bookmarks