summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcore_mac_p.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-05-27 18:36:13 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-05-29 17:11:40 +0200
commita67b25067ee78e0c2bc4e77a4c61af43528d9bc2 (patch)
tree4dd117fb04dccbc037b3c41b83403ed4a62b0e0f /src/corelib/kernel/qcore_mac_p.h
parentc3571d2922d41617e81fa9e8ae971d08fb9e94af (diff)
Rename QMacScopedObserver to the more fittingly QMacNotificationObserver
Change-Id: I1d8280fe88871572a3a27e612de49717b3b9ef77 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/corelib/kernel/qcore_mac_p.h')
-rw-r--r--src/corelib/kernel/qcore_mac_p.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index f96e7358a2..2428faed15 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -295,13 +295,13 @@ QT_MAC_WEAK_IMPORT(_os_activity_current);
// -------------------------------------------------------------------------
#if defined( __OBJC__)
-class QMacScopedObserver
+class QMacNotificationObserver
{
public:
- QMacScopedObserver() {}
+ QMacNotificationObserver() {}
template<typename Functor>
- QMacScopedObserver(id object, NSNotificationName name, Functor callback) {
+ QMacNotificationObserver(id object, NSNotificationName name, Functor callback) {
observer = [[NSNotificationCenter defaultCenter] addObserverForName:name
object:object queue:nil usingBlock:^(NSNotification *) {
callback();
@@ -309,13 +309,13 @@ public:
];
}
- QMacScopedObserver(const QMacScopedObserver& other) = delete;
- QMacScopedObserver(QMacScopedObserver&& other) : observer(other.observer) {
+ QMacNotificationObserver(const QMacNotificationObserver& other) = delete;
+ QMacNotificationObserver(QMacNotificationObserver&& other) : observer(other.observer) {
other.observer = nil;
}
- QMacScopedObserver &operator=(const QMacScopedObserver& other) = delete;
- QMacScopedObserver &operator=(QMacScopedObserver&& other) {
+ QMacNotificationObserver &operator=(const QMacNotificationObserver& other) = delete;
+ QMacNotificationObserver &operator=(QMacNotificationObserver&& other) {
if (this != &other) {
remove();
observer = other.observer;
@@ -329,7 +329,7 @@ public:
[[NSNotificationCenter defaultCenter] removeObserver:observer];
observer = nil;
}
- ~QMacScopedObserver() { remove(); }
+ ~QMacNotificationObserver() { remove(); }
private:
id observer = nil;