- //! Call the given slot on change of the given key
- virtual void notify(const QString &key, QObject *receiver, const char *slot);
+ //! Calls the given slot on change of the given key
+ template<typename Receiver, typename Slot>
+ void notify(const QString& key, const Receiver* receiver, Slot slot) const
+ {
+ static_assert(!std::is_same<Slot, const char*>::value, "Old-style slots not supported");
+ QObject::connect(notifier(normalizedKey(_group, keyForNotify(key))), &SettingsChangeNotifier::valueChanged, receiver, slot);
+ }