mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-16 06:05:52 -06:00
| .. | ||
| native | ||
| net | ||
| .gitignore | ||
| README.md | ||
Hosting
Purpose
Most of the time, it is easier to have .NET serve the entry point of your application (Program.cs). This approach works consistently across platforms and IDEs.
However, sometimes you need greater control over how Qt is initialized on start. Or, you have some C/C++ code that needs to be run before the applications stars. Or, you need to register custom QObject classes with QML. You get the idea.
Regardless, the following approach allows you to create a Qt project in tradtional way (with .qrc files, linked libs, etc) while still using Qml.Net.
Benefits
- Traditional Qt/QML application with complete control over the generated main executable.
- No need for the
Qml.Net.*Binariespackages since the native components needed forQml.Netare linked in the main executable and passed to .NET via magic.
Running the sample
Running the sample is straight forward. It is the best way to get the gist of how things are working (it's simple, IMO).
- Step 1: Build the .NET entrypoint application.
cd net
dotnet build
- Step 2: Open
native/NativeHost.proin Qt Creator and run it.
That's it.
The interesting parts
Follow phases 1-9 across the following files: