Signals cannot be emitted outside of the class that defines them (or derives from the class that defines them) without invoking it through the QMetaObject
system:
QMetaObject::invokeMethod( myObj, "mySignal",
Q_ARG( QString, "str" ),
Q_ARG( int, 42 ) );
However there doesn't appear to be an API method of getting all objects of all particular type to emit, the nearest I could find is:
for ( QWidget* widget : QApplication::allWidgets() ) {
if ( dynamic_cast< myType* >( widget ) ) {
QMetaObject::invokeMethod( widget, "mySignal",
Q_ARG( QString, "str" ),
Q_ARG( int, 42 ) );
}
}
But obviously this only works for QWidget
derived types, there doesn't appear to be a QObject
equivalent.