aboutsummaryrefslogtreecommitdiffstats
path: root/include/qdotnetobject.h
diff options
context:
space:
mode:
authorMiguel Costa <[email protected]>2025-05-15 16:35:39 +0200
committerMiguel Costa <[email protected]>2025-07-01 10:44:58 +0000
commit148a6b9e371b578c001a1c941dcb4d0b0f16fe30 (patch)
tree7595d5e535d18e81e66aeb3b1cdf4c5f11234c22 /include/qdotnetobject.h
parent0130a895ea9b9367198d096a782a04b291b50633 (diff)
Add access to .NET constants and fieldsHEADdev
Task-number: QTBUG-134961 Change-Id: I447a125faa5e40fea07bd9957a4b80192d582f96 Reviewed-by: Karsten Heimrich <[email protected]>
Diffstat (limited to 'include/qdotnetobject.h')
-rw-r--r--include/qdotnetobject.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/qdotnetobject.h b/include/qdotnetobject.h
index 5657c6f..01a2fd2 100644
--- a/include/qdotnetobject.h
+++ b/include/qdotnetobject.h
@@ -237,6 +237,49 @@ public:
return QDotNetType::constructor(typeName, ctor);
}
+ template<typename T>
+ QDotNetFunction<T, QDotNetRef> fieldGet(const QString &fieldName)
+ {
+ const QList<QDotNetParameter> parameters
+ {
+ QDotNetInbound<T>::Parameter,
+ QDotNetOutbound<QDotNetRef>::Parameter
+ };
+
+ return adapter().resolveInstanceFieldGet(*this, fieldName, parameters);
+ }
+
+ template<typename T>
+ QDotNetFunction<T, QDotNetRef> fieldGet(const QString &fieldName,
+ QDotNetFunction<T, QDotNetRef> &func)
+ {
+ if (!func.isValid())
+ func = fieldGet<T>(fieldName);
+ return func;
+ }
+
+ template<typename T>
+ QDotNetFunction<void, QDotNetRef, T> fieldSet(const QString &fieldName)
+ {
+ const QList<QDotNetParameter> parameters
+ {
+ QDotNetInbound<void>::Parameter,
+ QDotNetOutbound<QDotNetRef>::Parameter,
+ QDotNetOutbound<T>::Parameter,
+ };
+
+ return adapter().resolveInstanceFieldSet(*this, fieldName, parameters);
+ }
+
+ template<typename T>
+ QDotNetFunction<void, QDotNetRef, T> fieldSet(const QString &fieldName,
+ QDotNetFunction<void, QDotNetRef, T> &func)
+ {
+ if (!func.isValid())
+ func = fieldSet<T>(fieldName);
+ return func;
+ }
+
void subscribe(const QString &eventName, QDotNetEventHandler *eventHandler)
{
adapter().addEventHandler(*this, eventName, eventHandler, eventCallback);