Ugh... Qt4 porting

Lars Knoll lars at trolltech.com
Mon May 16 15:18:38 BST 2005


On Monday 16 May 2005 15:40, Mosfet wrote:
> Lars wrote:
> >> I hate to say it, but now I am beginning to feel that TrollTech is
> >> changing things just to be difficult :P
> >
> >Sure. That's all we ever wanted to achieve with Qt 4.
>
> Well, that does seem to be the general consensus, (sorry, that was low ;-).
> ...snip...
>
> >> Trivial changes include no longer using convertDepth() but a format
> >> enum.
>
> ...snip...
>
> > How is it harder to write "image.convertToFormat(QImage::Format_ARGB32)
> > than "image.convertDepth(32)"?
>
> ...snip...
>
> Note I said "trivial". That's not a big deal, I'm just listing the changes
> here.
>
> ...snip...
>
> >> There is no longer a create method either, the only way I can see to
> >> allocate an empty image is to assign it from another one. Not ideal, but
> >> I can deal with it.
> >
> >QImage(width, height, QImage::Format_ARGB32) gives you an empty image with
> >the dimensions and format specified. What more do you need?
>
> Uhm, that is not an empty image. An empty image is a null one. You supply
> constructors to create NULL images but no way to actually allocate the data
> except for assignment.
>
> Excuse me but this seems rather silly. Doing a create method is only a
> couple lines of code to allocate the private data.

img = QImage(w,h,format); does exactly the same.

> NULL images are used when you don't know what format the image is going to
> be in, create it in it's own scope, then modify or return it outside the
> scope.
>
> >First of all it's still there as a Qt3Support method. We removed it
> > because the jump table is a rather strange concept for people who can't
> > multiply and add (so you can write scanline = jumpTable()[i] instead of
> > scanline = data() + i*bytePerLine()). It doesn't give you a whole lot and
> > wastes some memory for every image.
>
> Yes, you can do pointer arithmetic instead but it's very nice to also be
> able to randomly access pixels w/ x and y array indexes. Like a lot of
> stuff that has been removed it's not strictly necessary, but useful. I'll
> ignore the "can't multiply or add" part :P

I was being sarcastic ;-)

> A jumptable shouldn't waste memory unless if you create one.

Right. And that's how it's implemented in Qt 4. I still don't really see the 
need to have this as a regular method in Qt4.

Cheers,
Lars




More information about the kde-core-devel mailing list