[Kde-java] Qt and KDE java package names
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Fri Aug 8 14:03:56 CEST 2003
Currently all Qt classes are in package 'org.kde.qt.*' and all KDE classes are
in 'org.kde.koala.*'. I chose these names because I thought it was the
'correct thing' to do in Java (ie all lower case, 'DNS in reverse' style). I
assume it was important to have names like this when applets were all the
range, and we were going download them from all over the net.
In PerlQt and QtRuby, there is a Qt:: namespace with names like Qt::Widget
with no Q. I assume that there would be a KDE:: namespace for KDE. So why
should java be different? What advantage do these long names have? How about
this instead for java:
'import Qt.*;
...
Widget myWidget = new Qt.Widget();
The disadvantage of the current long package names is that you really need to
fully qualify classnames in slots/signal connect statements. There is some
really hacky code in QtJava to 'deduce' the package name from whether or not
it begins with a 'Q', so you don't have to do that. Who wants to write:
connect(myapp, "SLOT(org.kde.qt.QWidget, org.kde.koala.KPart)", ...
That is fine when all the KDE classes are in one package, but an important
enhancement will be to split them up into packages which map onto the C++
namespace - 'kparts', 'kio' and so on. And as soon as the KDE classes are in
more than one package, the above solution doesn't work.
Here is an interesting thread which discusses the problems with the java
packing structure (in terms of ruby, but still relevant to java):
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/27584
-- Richard
More information about the Kde-java
mailing list