www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Qt and KDELibs for D?

reply just jeff <jeffrparsons optusnet.com.au> writes:
Firstly, is anybody working on Qt bindings for D? If so, the rest of 
this message is probably irrelevant and can safely be ignored. But 
continuing under the assumption that nobody is... :P

I'm wondering what would be involved in a project like that. Has anybody 
looked into hooking into C++ libraries enough to know what would be the 
best plan of attack? (And for Qt in particular, I hear it uses some 
custom pre-processor magic on top of the standard C++ one; is this 
right, and is this likely to be a huge problem?)

Qt Jambi 
(http://doc.trolltech.com/qtjambi-1.0/com/trolltech/qt/qtjambi-index.html) 
seems to be doing a similar thing for Java, so I presume they got over 
any problems with multiple inheritance. What other major problems would 
there be?

Any random thoughts appreciated.
Jan 29 2007
next sibling parent Jascha Wetzel <"[firstname]" mainia.de> writes:
afaik, most of the preprocessor magic is to create a decent signal/slot
mechanism. slots get indexed in order of appearence and an implicitly
generated function "invoke" dispatches calls with these indeces.
Qt relies on C++ linkage to access these invoke/emit (and other) functions.
to properly pass the Qt framework calls to D delegates, an intermediate
C++ object would have to be generated for each D widget, i guess.

on the other hand, the fact that trolltech laid down a lot of action to
create this signal/slot thing, they should be tempted to port their
whole framework to D ;)

just jeff wrote:
 Firstly, is anybody working on Qt bindings for D? If so, the rest of
 this message is probably irrelevant and can safely be ignored. But
 continuing under the assumption that nobody is... :P
 
 I'm wondering what would be involved in a project like that. Has anybody
 looked into hooking into C++ libraries enough to know what would be the
 best plan of attack? (And for Qt in particular, I hear it uses some
 custom pre-processor magic on top of the standard C++ one; is this
 right, and is this likely to be a huge problem?)
 
 Qt Jambi
 (http://doc.trolltech.com/qtjambi-1.0/com/trolltech/qt/qtjambi-index.html)
 seems to be doing a similar thing for Java, so I presume they got over
 any problems with multiple inheritance. What other major problems would
 there be?
 
 Any random thoughts appreciated.

Jan 29 2007
prev sibling next sibling parent reply Gregor Richards <Richards codu.org> writes:
It's much, much easier to bind a C library than a C++ library.

qtc is a C binding to Qt.

  - Gregor Richards

PS: I don't know if it uses the same nasty preprocessor junk as Qt C++ ...

PPS: However, after binding it, you won't have anything like the 
original interface - you'll have a very OO-lacking C interface.

just jeff wrote:
 Firstly, is anybody working on Qt bindings for D? If so, the rest of 
 this message is probably irrelevant and can safely be ignored. But 
 continuing under the assumption that nobody is... :P
 
 I'm wondering what would be involved in a project like that. Has anybody 
 looked into hooking into C++ libraries enough to know what would be the 
 best plan of attack? (And for Qt in particular, I hear it uses some 
 custom pre-processor magic on top of the standard C++ one; is this 
 right, and is this likely to be a huge problem?)
 
 Qt Jambi 
 (http://doc.trolltech.com/qtjambi-1.0/com/trolltech/qt/qtjambi-index.html) 
 seems to be doing a similar thing for Java, so I presume they got over 
 any problems with multiple inheritance. What other major problems would 
 there be?
 
 Any random thoughts appreciated.

Jan 29 2007
parent reply just jeff <jeffrparsons optusnet.com.au> writes:
Any idea how Py Qt, Qt Jambi et al did it? An OO wrapper around the 
"flattened" qtc? o_0
Jan 29 2007
parent reply Gregor Richards <Richards codu.org> writes:
just jeff wrote:
 Any idea how Py Qt, Qt Jambi et al did it? An OO wrapper around the 
 "flattened" qtc? o_0

I don't know about either of those ... PyQt might, but it's probably not too difficult to write C++ extensions to Python. Qt Jambi probably doesn't, I can't imagine Qt depending on a Qt binding they didn't write ... QtC#, for example, uses QtC. - Gregor Richards
Jan 29 2007
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Gregor Richards wrote:
 just jeff wrote:
 Any idea how Py Qt, Qt Jambi et al did it? An OO wrapper around the 
 "flattened" qtc? o_0

I don't know about either of those ... PyQt might, but it's probably not too difficult to write C++ extensions to Python.

PyQt uses something called SIP. http://www.riverbankcomputing.co.uk/sip/index.php
 Qt Jambi probably 
 doesn't, I can't imagine Qt depending on a Qt binding they didn't write ...
 
 QtC#, for example, uses QtC.
 
  - Gregor Richards

Jan 29 2007
prev sibling next sibling parent "Craig Black" <cblack ara.com> writes:
We use Qt for a C++ project.  We have developed many wrappers for Qt classes 
for technical reasons.  One reason is that we hate annoying moc files. 
Anyway, we are on our way to having our entire GUI written using wrapper 
classes.  We have a somewhat complex solution to eliminate the need for moc 
files.  Because of this, we only have one moc file for all of our wrapper 
classes.  We retain most of the Qt functionality, including signals/slots, 
and event interception using custom C++ delegate classes.  One drawback is 
that we cannot override virtual methods in Qt classes very easily.  A long 
term goal of mine has always been to port our project to D.  But if we did, 
we would drop Qt and use a GUI native to D.  We would have to rewrite our 
wrapper classes to accommodate this, but its easier than rewriting the 
entire GUI.

-Craig

"just jeff" <jeffrparsons optusnet.com.au> wrote in message 
news:epkgmb$2b33$1 digitaldaemon.com...
 Firstly, is anybody working on Qt bindings for D? If so, the rest of this 
 message is probably irrelevant and can safely be ignored. But continuing 
 under the assumption that nobody is... :P

 I'm wondering what would be involved in a project like that. Has anybody 
 looked into hooking into C++ libraries enough to know what would be the 
 best plan of attack? (And for Qt in particular, I hear it uses some custom 
 pre-processor magic on top of the standard C++ one; is this right, and is 
 this likely to be a huge problem?)

 Qt Jambi 
 (http://doc.trolltech.com/qtjambi-1.0/com/trolltech/qt/qtjambi-index.html) 
 seems to be doing a similar thing for Java, so I presume they got over any 
 problems with multiple inheritance. What other major problems would there 
 be?

 Any random thoughts appreciated. 

Jan 29 2007
prev sibling parent just jeff <jeffrparsons optusnet.com.au> writes:
Does anybody know what approach Qt Jambi has taken, and whether any of 
their work could be used for a D version?
Jan 29 2007