Qml / QtQuick
Hecatron opened this issue · 11 comments
This is probably something to be looked at later on for the back burner once we have more of the basic Qt Widgets tested out, but I figured I'd write a bit about it here
The latest QtSharp release now seems to work fine with loading .ui files, and creating widgets.
I've not yet tested all the functionality such as slots etc. But one of the things I noticed is that the latest Qt releases now have a drag and drop visual editor for Qml / QtQuick which is sort of Qt's answer to the next generation gui / windows wpf equivilent.
https://wiki.qt.io/Introduction_to_Qt_Quick_for_C%2B%2B_Developers
I had a quick go at loading in Qml as a module into QtSharp, but it looks like it needs QtNetworking as a dependency. So I added in QtNetworking to see how far I could get with that
this resulted in
d:\SourceControl\GitExternal\QtSharp.ddobrev\QtSharp.CLI\bin\Debug\QtNetwork.cs(16587,28) : error CS0216: The operator 'QtNetwork.QHostAddress.operator ==(QtNetwork.QHostAddress.SpecialAddress, QtNetwork.QHostAddress)' requires a matching operator '!=' to also be defined
QtQuick is definitely on my list but since I am forced to work on Qt# in-between because of paid jobs, there will be a while until it's complete. The time-consuming part there is the integration between the host language (C#) and QML, there has to be a way of defining properties and events (signals) in C# so that they are invoked as needed in QML and vice-versa.
About QtNetwork, I know about this bug. I have actually already filed it at mono/CppSharp#569, you are welcome to track its progress or even send a patch.
QtNetwork works now and is added to my new release: https://github.com/ddobrev/QtSharp/releases/tag/0.0.4 .
QtQml has been added: https://github.com/ddobrev/QtSharp/releases/tag/0.0.5 .
Thank you for testing, please continue with it.
Thanks for adding QtQml support that's awesome
Is there any reason why this issue is not closed ?
Some of the stuff within QT uses templates such as
display->findChild<QPushButton *>("bar");
display->findChildren<QWidget *>();
In order for that to work in C# you need to translate it across to generics in C# (same thing but by a different name). But that's not quite in CppSharp yet which is what QtSharp relies on.
so if you happen to use some code that doesn't involve generics / templates then it might work, but you won't be able to use any of the Qt API's that do use generics / templates which may limit what you can do
If you need Qml integration, I am working on a project that does exactly this. I'd consider it usable for production.
@pauldotknopf thank you, I'll definitely have it in mind. I can see you've written your own bridge instead of using CppSharp which makes me a little sad but I still think we could collaborate.
Yeah, I'm open to a collaboration.
Unfortunately, CppSharp wouldn't work for the QML stuff, since there has to be a native component to work closely with the qml-private
headers.