swift
passiveobserver.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
7 
9 
11 {
13  {
14  QMutexLocker lock(&m_eventSubscriptionMutex);
15  m_eventSubscription = param;
16  lock.unlock();
17  emit eventSubscriptionChanged(param);
18  }
19 
21  {
22  QMutexLocker lock(&m_eventSubscriptionMutex);
23  return m_eventSubscription;
24  }
25 
26  void CPassiveObserver::handleEvent(const CVariant &param) const { m_eventHandler(param); }
27 } // namespace swift::misc::shared_state
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition: variant.h:66
void handleEvent(const CVariant &param) const
Called when a subscribed event is emitted.
CVariant eventSubscription() const
Get the object that determines which events are subscribed to.
void eventSubscriptionChanged(const swift::misc::CVariant &param)
Emitted by setEventSubscription.
void setEventSubscription(const CVariant &param)
Set the object that determines which events are subscribed to.
Utilities for sharing state between multiple objects.
Definition: application.h:48
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.
Definition: valueobject.h:67