Qt bindings for D
Abdulhaq
alynch4047 at gmail.com
Sun Oct 13 13:52:29 PDT 2013
On Sunday, 13 October 2013 at 20:41:01 UTC, michaelc37 wrote:
> On Sunday, 13 October 2013 at 12:39:55 UTC, Abdulhaq wrote:
>> Hi guys
>>
>> a few months ago I tried to find working bindings for Qt and
>> the best I could see was qtd. I tried compiling it but it
>> didn't go too well on my Linux 64bit machine, and saw in the
>> forums that the original developers had ceased maintaining it.
>> Because I have been using Qt for around 10 years or so now
>> (mainly from python but a little C++ too) I had a go at
>> getting it to work again.
>>
>> It took a few weekends but I got the main examples going
>> (Core, GUI, XML etc) with Qt 4.8 and 2.062. I felt that I was
>> having to do some rewinding of where the original developers
>> were going (it seemed that they were trying to take QRect et
>> al down the struct route, but my to my newbie eyes it seemed
>> doomed because it was making assumptions about the way the C++
>> and D compilers were laying out the struct data that didn't
>> work on my machine - but I could be wrong about that). Anyway
>> I treated it as an educational exercise and make QRect et al.
>> regular classes, and got it generally working again.
>>
>> Then real life took over again and I had to shelve the
>> project, but now I have a little spare time again. I suspect
>> there are other developers such as myself out there who are
>> keen to try D but would like to use it with Qt, so I thought I
>> would let you know what I had done in case others were
>> interested. I'm kind of hoping that someone will say that the
>> job is already done, but I suspect that is not the case.
>>
>> The original developers did a really great job of the wrapping
>> and left the build system in a really good state too. However,
>> there seems to be very little testing other than the standard
>> qt examples themselves, so I can't be sure exactly where the
>> wrapping stands. Although the original developers felt that it
>> had some way to go before being really useful, it seems to me
>> that they had achieved more than that and that some would want
>> to use it as it stood.
>>
>> Unfortunately the wrapping is based on QtJambi, which is now
>> dead, but anyway it's easy with hindsight isn't it.
>>
>> Is anyone else interested and can anyone help me with
>> polishing it? It needs testing, trying out on Windows, and
>> some improvements to the build system. I have very little time
>> ATM but it would be good to capture where I've got to so that
>> others could pick it up or just experiment with D and Qt.
>>
>> regards
>> Abdulhaq
>
> Hi, my story is similar to yours.
> but anyway long story short,
> i recently managed to get it compiling again with qt 4.8 and
> dmd 2.063.2.
> https://bitbucket.org/michaelc37/qtd-experimental
>
> i think for the QRect problem i ended up passing pointers, i
> also updated alot of the examples.
>
> i'd like to have a look at your work where can i find it?.
Hah, sounds like we did exactly the same thing :-) ! I haven't
uploaded the code anywhere yet, I was waiting to see if anyone
was interested...
I also ran into a problem (I think I remember correctly) in the
QMetaTypeImpl.d area, worrying about code like:
// COMPILER BUG: cannot put this inside
qRegisterMetaTypeStreamOperators
// COMPILER BUG 2: cannot use extern(C) with templated functions:
extern(C) void foo(T)(){}
private template streamOpShim(alias op)
{
extern(C) void streamOpShim()
{
asm
{
naked;
push EBP;
mov EBP, ESP;
mov EAX, 0x8[EBP];
push EAX;
mov EAX, 0xC[EBP];
call op;
leave;
ret;
}
}
}
as to whether it would work in 64bit or not? I think I came to
the conclusion that this was a very minor part of Qt and not to
worry about it...
Coming back to the code now I think i'm going to have to read the
D book again before I have another stab at it...
More information about the Digitalmars-d
mailing list