mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-15 14:15:54 -06:00
Adding support for auto generating notify signals.
This commit is contained in:
parent
b4becbea92
commit
42bbb3f17a
2 changed files with 15 additions and 0 deletions
|
|
@ -146,6 +146,19 @@ namespace Qml.Net.Internal
|
|||
|
||||
NetSignalInfo notifySignal = null;
|
||||
var notifySignalAttribute = propertyInfo.GetCustomAttribute<NotifySignalAttribute>();
|
||||
|
||||
// All properties have a default notify signal.
|
||||
// This is so that when we read properties in QML,
|
||||
// we don't get errors with "NON-NOTIFY PROPERTY BOUND
|
||||
if (notifySignalAttribute == null && QmlNetConfig.AutoGenerateNotifySignals)
|
||||
{
|
||||
var dynamicName = $"dynamic__{propertyInfo.Name}Changed";
|
||||
notifySignalAttribute = new NotifySignalAttribute
|
||||
{
|
||||
Name = dynamicName
|
||||
};
|
||||
}
|
||||
|
||||
if (notifySignalAttribute != null)
|
||||
{
|
||||
var name = notifySignalAttribute.Name;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ namespace Qml.Net
|
|||
|
||||
public static bool ShouldEnsureUIThread { get; set; } = true;
|
||||
|
||||
public static bool AutoGenerateNotifySignals { get; set; } = false;
|
||||
|
||||
public static Action EnsureUIThreadDelegate = () =>
|
||||
{
|
||||
if (!QCoreApplication.IsMainThread)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue