www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Why is it hard to make Qt bindings?

reply drug <drug2004 bk.ru> writes:
There were several attempts to make Qt binding for dlang, but either 
they has failed or has been stalled. It would be nice to collect that 
experience. Considering 2.081 supports C++ special member (not all but 
majority) isn't it time to make another attempt or the problem is more 
complex?
Could you publish your experience in making Qt bindings here?
Jul 05 2018
next sibling parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 7/5/18 4:42 AM, drug wrote:
 There were several attempts to make Qt binding for dlang, but either 
 they has failed or has been stalled. It would be nice to collect that 
 experience. Considering 2.081 supports C++ special member (not all but 
 majority) isn't it time to make another attempt or the problem is more 
 complex?
 Could you publish your experience in making Qt bindings here?
I'm not a Qt user, but doesn't Qt require a special pre-compiler, or even use the preprocessor in a way that is difficult to duplicate in D? I remember there being a project for qt for D a long time ago. I think this is it: http://www.dsource.org/projects/qtd You may find some way to resurrect this. -Steve
Jul 05 2018
next sibling parent Mike Parker <aldacron gmail.com> writes:
On Thursday, 5 July 2018 at 12:52:49 UTC, Steven Schveighoffer 
wrote:

 I remember there being a project for qt for D a long time ago. 
 I think this is it: http://www.dsource.org/projects/qtd

 You may find some way to resurrect this.
And QtE5 is still active. He announced support for QML not too long ago, I think. https://github.com/MGWL/QtE5
Jul 05 2018
prev sibling parent Tony <tonytdominguez aol.com> writes:
On Thursday, 5 July 2018 at 12:52:49 UTC, Steven Schveighoffer 
wrote:
 On 7/5/18 4:42 AM, drug wrote:
 There were several attempts to make Qt binding for dlang, but 
 either they has failed or has been stalled. It would be nice 
 to collect that experience. Considering 2.081 supports C++ 
 special member (not all but majority) isn't it time to make 
 another attempt or the problem is more complex?
 Could you publish your experience in making Qt bindings here?
I'm not a Qt user, but doesn't Qt require a special pre-compiler, or even use the preprocessor in a way that is difficult to duplicate in D?
Qt does have it's own pre-processor, but CopperSpice, a fork of Qt does not require that. http://www.copperspice.com/
Jul 05 2018
prev sibling next sibling parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Thursday, July 05, 2018 11:42:39 drug via Digitalmars-d-learn wrote:
 There were several attempts to make Qt binding for dlang, but either
 they has failed or has been stalled. It would be nice to collect that
 experience. Considering 2.081 supports C++ special member (not all but
 majority) isn't it time to make another attempt or the problem is more
 complex?
 Could you publish your experience in making Qt bindings here?
Qt takes advantage of just about every advanced C++98 feature under the sun, and on top of that, it uses its own preprocessor for stuff like signals and slots so that you can do signal: and slot: in your code and have the functions that follow treated as signals and slots, and various bits of code get generated to go with all of that. It also does some very specific stuff with how it handles memory which can be a bit entertaining to make work well with D code. And of course, Qt makes heavy use of multiple inheritance, and while that can be dealt with on some level with interfaces, all of the various issues combined make it particularly difficult if you want to be able to do the equivalent of new MyQWidget and have it work properly. There are ways to work around most of it in D, but it's hard - especially if you don't want to be generating C++ code as part of your D project that uses Qt. Binding to C++ is far harder than C, and with Qt being as complicated as it is with what it's done, it makes it very hard to make D bindings for - not impossible, but very hard. If someone were _trying_ to make a C++ project that was hard to bind to, they could probably make it much worse (e.g. much heavier use of templates), but Qt did a pretty amazing job of making it hard even without that being their goal. I actually started on creating bindings (more wrappers for it really) a while back, but I have a long way to go on it and have gotten sidetracked - e.g. one of the main reasons that I wrote dxml was because I'm using XML files to configure code generation for the bindings, and I didn't want to continue to use std.experimental.xml for that (not only is it unsupported, but I had to work around various issues while using it, so it clearly was unacceptable long term). - Jonathan M Davis
Jul 05 2018
prev sibling parent MGW <mgw yandex.ru> writes:
On Thursday, 5 July 2018 at 08:42:39 UTC, drug wrote:
 There were several attempts to make Qt binding for dlang ...
QtE 5 works great on Win32/64, Linux 32/64 and Mac OS x 64. The main difference is that Qt5 uses a set of pre-defined slots and signals rather than creating them using a MOC or creating them dynamically as dqml. Qt5 has several large applications running on dozens of computers in different companies. If you use dynamic slots and signals from qml in Qt 5, you can fully play all the functionality of Qt5 with dlang. But this is a very big project of the future ...
Jul 07 2018