Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qobject_impl.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QOBJECT_H
5#error Do not include qobject_impl.h directly
6#endif
7
8#if 0
9#pragma qt_sync_skip_header_check
10#pragma qt_sync_stop_processing
11#endif
12
13QT_BEGIN_NAMESPACE
14
15
16namespace QtPrivate {
17 /*
18 Logic to statically generate the array of qMetaTypeId
19 ConnectionTypes<FunctionPointer<Signal>::Arguments>::types() returns an array
20 of int that is suitable for the types arguments of the connection functions.
21
22 The array only exist of all the types are declared as a metatype
23 (detected using the TypesAreDeclaredMetaType helper struct)
24 If one of the type is not declared, the function return 0 and the signal
25 cannot be used in queued connection.
26 */
27 template <typename ArgList> struct TypesAreDeclaredMetaType { enum { Value = false }; };
28 template <> struct TypesAreDeclaredMetaType<List<>> { enum { Value = true }; };
29 template <typename Arg, typename... Tail> struct TypesAreDeclaredMetaType<List<Arg, Tail...> >
31
32 template <typename ArgList, bool Declared = TypesAreDeclaredMetaType<ArgList>::Value > struct ConnectionTypes
33 { static const int *types() { return nullptr; } };
34 template <> struct ConnectionTypes<List<>, true>
35 { static const int *types() { return nullptr; } };
36 template <typename... Args> struct ConnectionTypes<List<Args...>, true>
37 { static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper<Args>::qt_metatype_id())..., 0 }; return t; } };
38}
39
40
41QT_END_NAMESPACE
static const int * types()