mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-16 14:15:57 -06:00
[GH-ISSUE #235] Getting C# reference to RegisterSingletonType instance #152
Labels
No labels
bug
enhancement
help wanted
help wanted
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/qmlnet#152
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @YTN0 on GitHub (Apr 27, 2021).
Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/235
I am new to qt / qml and have started experimenting with using qml.net. So far it's been working really well. I have not been able to figure out how to get the reference to a singleton instance in my c# code. I have used the RegisterSingletonType method which works fine, and I can use the singleton instance in the qml code without issues.
However, I need to reference the same singleton instance from c# to update some data. Can someone please clarify how this can be done?
Thanks.
@pauldotknopf commented on GitHub (Apr 27, 2021):
I'm not sure there is a way.
I guess you can update the
ctorof your .NET type, to putthisinto a static variable that can be accessed elsewhere?@YTN0 commented on GitHub (May 16, 2021):
Thanks for the response. I managed to find a solution for this.