blob: 63aaecb91d82ff5092457a76ff7acee8291dda90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/***************************************************************************************************
Copyright (C) 2025 The Qt Company Ltd.
SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
***************************************************************************************************/
#pragma once
#include "qdotnetobject.h"
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wconversion"
#endif
#include <QString>
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
template<typename T, typename... TArg>
class QDotNetDelegate : public QDotNetObject
{
public:
Q_DOTNET_OBJECT_INLINE(QDotNetDelegate, "System.Delegate");
QDotNetDelegate() : QDotNetObject(nullptr) { }
T invoke(TArg... arg) const
{
return method("Invoke", fnInvoke).invoke(*this, arg...);
}
T operator()(TArg... arg) const
{
return invoke(arg...);
}
private:
mutable QDotNetFunction<T, TArg...> fnInvoke;
};
|