6#include <albert/export.h>
31 setExtensionRegistry(registry);
38 QObject::disconnect(conn_add);
39 conn_add = QObject::connect(registry, &ExtensionRegistry::added,
40 [
this](
Extension *e){
if (T *t =
dynamic_cast<T*
>(e)) onAdd(t); });
42 QObject::disconnect(conn_rem);
43 conn_rem = QObject::connect(registry, &ExtensionRegistry::removed,
44 [
this](
Extension *e){
if (T *t =
dynamic_cast<T*
>(e)) onRem(t); });
58 QObject::disconnect(conn_add);
59 QObject::disconnect(conn_rem);
63 QMetaObject::Connection conn_add;
64 QMetaObject::Connection conn_rem;
The common extension pool.
Definition extensionregistry.h:23
Non-QObject extension registry observer.
Definition extensionwatcher.h:24
ExtensionWatcher(ExtensionRegistry *registry=nullptr)
ExtensionWatcher constructor.
Definition extensionwatcher.h:28
void setExtensionRegistry(ExtensionRegistry *registry)
Sets the extension registry to track.
Definition extensionwatcher.h:36
virtual ~ExtensionWatcher()
Destructor must not be called though this interface.
Definition extensionwatcher.h:56
virtual void onRem(T *)
Called when an extension has been deregistered.
Definition extensionwatcher.h:53
virtual void onAdd(T *)
Called when an extension has been registered.
Definition extensionwatcher.h:50
Abstract extension class.
Definition extension.h:19