Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for QQuickItem #44

Open
filcuc opened this issue Aug 28, 2016 · 13 comments
Open

Add support for QQuickItem #44

filcuc opened this issue Aug 28, 2016 · 13 comments

Comments

@filcuc
Copy link
Owner

filcuc commented Aug 28, 2016

it would be cool to being able to create QQuickItem instances from a binded language.
This woud allow custom QQuickItems. For sure this is going to be a big task

@drug007
Copy link
Contributor

drug007 commented Apr 16, 2017

I'm curious won't it be simpler to interface to C++ directly from dlang?

@filcuc
Copy link
Owner Author

filcuc commented Apr 16, 2017 via email

@drug007
Copy link
Contributor

drug007 commented Apr 16, 2017

I mean do not use intermediate c layer but link against c++ code directly using extern(C++) (plus some wrapper of course for special members)

@filcuc
Copy link
Owner Author

filcuc commented Apr 16, 2017 via email

@drug007
Copy link
Contributor

drug007 commented Apr 16, 2017

I see, but may be dlang can be used to automate binding? But of course it's offtopic of this issue.

@filcuc
Copy link
Owner Author

filcuc commented Apr 16, 2017

A possible alternative is prototyping a generator with clang api in order to parse the C++ Qt headers and than generate our code. If it was me i would start with a python script given that is super simple and already gas clang bindings.

@drug007
Copy link
Contributor

drug007 commented Apr 17, 2017

Could you provide some example of the script to look for evaluation? have no experience with neither python nor clang, but some years ago I intended to write a plugin for clang, so I have some understanding.

@filcuc
Copy link
Owner Author

filcuc commented Apr 17, 2017 via email

@filcuc
Copy link
Owner Author

filcuc commented Apr 17, 2017 via email

@drug007
Copy link
Contributor

drug007 commented Apr 23, 2017

I managed to get the class name and list of methods and their args. Dirty output, but nevertheless. I forked dstep and made some addition to translate c++ code, you can check here. To build just type dub build, to translate QQuickItem use :
bin/dstep -I/usr/include/x86_64-linux-gnu/qt5/ -x c++ /usr/include/x86_64-linux-gnu/qt5/QtQuick/qquickitem.h -fPIC -o qquickitem.d

The problems now are (don't work):

  • enum translation
  • nested structs
  • some args of method
  • ctor/dtor aren't handled at all

Enum I guess need to be translated, not sure about nested structs, also don't know what to do with expanded Q_QBJECT like oid* qt_metacast (const(char)*); etc - they are translated, but should be?

@drug007
Copy link
Contributor

drug007 commented Apr 23, 2017

Now I try to make bindings to QPoint and already have some question like what's the best way to interface with c++ operators like div, mul etc - should they be just reimplemented in binding language?

Also because I'm intrested in dlang bindings I'll try to make its directly using dlang abilities just to research the sitiation to realize what to do. Afterwards it'll be possible to make bindings in "standard" way through C interface.

@filcuc
Copy link
Owner Author

filcuc commented Apr 23, 2017

@drug007 ok but honestly i'd go with a tool that uses clang and not some other techs. Using clang is the way to imho but this doesn't mean you can't do or research other ways. But i'm saying that just to be honest 😄 . Connected to this (since i mantain also DQml) i would not like to make it independent from DOtherSide or better: i would like to make it independent 'if and only if' we develop an automatic generation of bindings that is pluggable in order to be used also by rust and nim. Sorry for being straight but i prefear to be clear in my views on DOtherSide, DQml, NimQml and Rust bindings

@drug007
Copy link
Contributor

drug007 commented Apr 23, 2017

I totally understand your position about DOtherSide, I am agreed and will help with it if I can. Despite dlang abilities to link to c++ directly they aren't enought to avoid intermediate layer like DOtherSide.

What about clang - dstep uses libclang underhood and I'm sure that it is appropriate tool to base off, don't you think so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants