Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42bbb3f

Browse filesBrowse files
committed
Adding support for auto generating notify signals.
1 parent b4becbe commit 42bbb3f
Copy full SHA for 42bbb3f

File tree

2 files changed

+15
-0
lines changed
Filter options

2 files changed

+15
-0
lines changed

‎src/net/Qml.Net/Internal/DefaultCallbacks.cs

Copy file name to clipboardExpand all lines: src/net/Qml.Net/Internal/DefaultCallbacks.cs
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,19 @@ public void LoadTypeInfo(IntPtr t)
146146

147147
NetSignalInfo notifySignal = null;
148148
var notifySignalAttribute = propertyInfo.GetCustomAttribute<NotifySignalAttribute>();
149+
150+
// All properties have a default notify signal.
151+
// This is so that when we read properties in QML,
152+
// we don't get errors with "NON-NOTIFY PROPERTY BOUND
153+
if (notifySignalAttribute == null && QmlNetConfig.AutoGenerateNotifySignals)
154+
{
155+
var dynamicName = $"dynamic__{propertyInfo.Name}Changed";
156+
notifySignalAttribute = new NotifySignalAttribute
157+
{
158+
Name = dynamicName
159+
};
160+
}
161+
149162
if (notifySignalAttribute != null)
150163
{
151164
var name = notifySignalAttribute.Name;

‎src/net/Qml.Net/QmlNetConfig.cs

Copy file name to clipboardExpand all lines: src/net/Qml.Net/QmlNetConfig.cs
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ internal static void RaiseUnhandledTaskException(AggregateException ex)
1818

1919
public static bool ShouldEnsureUIThread { get; set; } = true;
2020

21+
public static bool AutoGenerateNotifySignals { get; set; } = false;
22+
2123
public static Action EnsureUIThreadDelegate = () =>
2224
{
2325
if (!QCoreApplication.IsMainThread)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.