[Kde-java] QAccel problem

Richard Dale kde-java@kde.org
Mon, 11 Feb 2002 11:15:24 +0000


On Saturday 09 February 2002 2:39 pm, Emond Papegaaij wrote:
> On Saturday 09 February 2002 13:48, Richard Dale wrote:
> > On Saturday 09 February 2002 12:50 am, Emond Papegaaij wrote:
> > > To gain some experience, I decided to
> > > convert all 14 tutorials. I can send you the code, if you want it.
> >
> > Yes please - that's really useful. I'll put the in the cvs in the
> > examples section of kdebindings.
>
> I've attached the tutorials, and 1 of the examples. The converted code will
> do exactly the same as the original (the example even uses QFile and
> QTextStream). All tutorials compile with QT2, but it's easy to convert them
> to QT3, you only have to change some constructors. There may still be some
> errors in the code, converting code by hand is really boring :)
Thanks - I've got them all working with Qt 3, and I'll check them in today.

> > > 1: The constructors with the default arguments are missing. This is not
> > > a big problem, you can find the default arguments in the qt-source, but
> > > it is a problem in our project group. Not everyone understands c++. But
> > > it's also annoying to have to write
> > >    quit.setFont(new QFont("Times", 18, QFont.Bold, false));
> > > in stead of
> > >    quit.setFont(new QFont("Times", 18, QFont.Bold));
> > >
> > > or
> > >    QGridLayout grid = new QGridLayout(this, 2, 2, 10, -1, null);
> > > in stead of
> > >    QGridLayout grid = new QGridLayout(this, 2, 2, 10);
> >
> > It generates just two methods for each constructor with defaults - one
> > with the least args, and one with the most. I thought if I generated an
> > extra method for each default arg, there would be too many methods, and
> > the api would look cluttered. But that was probably wrong, and it would
> > be better to generate the lot after all.. Meanwhile, it's easy to add
> > missing ones like those above by hand.
>
> I'm looking forward to the new version :)
It may not be the next version, as it's more work than it sounds - the method 
argument parser needs to be rewritten in 'yapp' (yacc like tool). Meanwhile, 
I've added extra constructors to QHBox, QVBox and QGridLayout (the Qt 3 
version of QFont has the constructor above).

> << QAccel connect problem >>
>
> > It wasn't connecting/disconnecting the java slot correctly in
> > QAccel.connectItem() and disconnectItem(). Please find a fixed Qt 2
> > version attached.
>
> Thanks, the new version works fine.
>
> > > 3: I tried to convert the canvas example, but this example uses
> > > QCanvasItemLists everywhere. This class is declared in qcanvas.h:
> > >    class QCanvasItemList : public QValueList<QCanvasItem*>
> > > QCanvasItemList is not declared as a java class, what would the java
> > > equivalent for this class be? Or is is impossible to convert such a
> > > construction to java? QCanvasItemList is commented out throughout the
> > > qtjava java code.
> >
> > It sounds as though that really should be added - either as a
> > java.util.ArrayList, or to 'QCanvasItemList'. I'll have a look at that,
> > and make sure it gets converted next time I regenerate the bindings.
>
> I think some of these classes are important. QCanvas is is quite useless
> like this, you can't get a list of all items on the canvas.
I've added QCanvasItemList -> java.util.ArrayList conversion to the code 
generation, and regenerated the QCanvas and QCanvasItem classes.

>
> I noticed one more thing: Why does QWMatrix.invert() take an array of int
> as argument? The QT version takes a bool.
That was a bug in the code generation, a 'bool *' argument type is now 
converted correctly to a 'boolean[]'. I've fixed the QWMatrix class in the 
cvs.

-- Richard