开发者

Generating Qt Bindings for .NET

开发者 https://www.devze.com 2023-03-31 10:10 出处:网络
I\'m currently working on a project that using Qt C++ and the API is exposed to Python using SIP.In order to make the program more attractive in the Windows environments I would like to expose the API

I'm currently working on a project that using Qt C++ and the API is exposed to Python using SIP. In order to make the program more attractive in the Windows environments I would like to expose the API to .NET.

I have found qt4dotnet although that is just Qt bindings, I need something to generate those bindings for my API. I heard SWIG "might" be able to generate bindings for Qt apps although I can't seem to find any help on this.

Anyone know something tha开发者_如何学JAVAt could help?


It might be worth investigating ActiveQt, and reading this document from Nokia that details integrating ActiveQt with the .NET Framework.

There's also a StackOverflow post which discusses wrapping Qt signals and slots (or generic methods) using Microsoft's C++/CLI extensions.

I'm not a .NET developer though, so I probably can't provide any more help than that.


In the kdebindings module, we have proper Qt bindings called Qyoto, based on our SMOKE library (a library shared by all our bindings, used to call C++ API, only depends on the STL).

Unfortunately the project is unmaintained as of now, due to lack of interest from *nix users.

However, it's very easy to extend SMOKE based bindings. You only need to generate a new SMOKE library from your own header files, a matching .NET assembly and write a Qyoto plugin. Generating the SMOKE library is done with smokegen and I've written a tool that generates .NET assemblies from SMOKE libraries (it hasn't been merged yet, however).

I guess that it will require some effort to bring the bindings up to date and actually make them work on Windows, but I think it's the best choice you have (if you don't want to hand-craft bindings). We already have support for all the QMetaObject stuff (including custom Signals, Slots, Q_PROPERTIES, Q_CLASSINFO, etc.) and extending the bindings is quite easy.

Regarding Windows, I've once got a Hello World working, but it seems that it isn't working anymore.

If you want to get involved, you can contact us at kde-bindings@kde.org or on #kde-bindings on Freenode.

P.S.: I would post more links, but the spam protection won't let me. You can find more information about SMOKE on projects.kde.org/smokeqt, projects.kde.org/smokegen and techbase.kde.org.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号