BluezQt

macros.h
1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2015 David Rosca <nowrep@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#ifndef BLUEZQT_MACROS_H
10#define BLUEZQT_MACROS_H
11
12// clang-format off
13
14// Change property value and emit propertyChanged signal
15#define PROPERTY_CHANGED(var, type_cast, signal) \
16 if (var != value.type_cast()) { \
17 var = value.type_cast(); \
18 Q_EMIT q.lock()->signal(var); \
19 }
20
21#define PROPERTY_CHANGED2(var, value, signal) \
22 const auto &val = value; \
23 if (var != val) { \
24 var = val; \
25 Q_EMIT q.lock()->signal(var); \
26 }
27
28// Clears property value and emit propertyChanged signal
29#define PROPERTY_INVALIDATED(var, empty, signal) \
30 if (var != empty) { \
31 var = empty; \
32 Q_EMIT q.lock()->signal(var); \
33 }
34
35#endif // BLUEZQT_MACROS_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:01:36 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.