Ugh... Qt4 porting

Lars Knoll lars at trolltech.com
Mon May 16 13:17:41 BST 2005


On Sunday 15 May 2005 05:15, Mosfet 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.

> I just updated from Qt4beta2 to today's snapshot. A ton of stuff has
> changed with QImage.
>
> Trivial changes include no longer using convertDepth() but a format enum.

Yes, since what does depth() == 32 mean? A8R8G8B8 or maybe R8G8B8A8 or the 
same with premultiplied alpha. Does depth() ==8 mean indexed8, or 8bit 
grayscale?

Just having a depth is simply not enough to describe the format of an image. 
You should know that. If we want to have the possibility to extend the list 
of supported image formats in the future, we need an enum. That's what we 
have now. 

Also: How is it harder to write "image.convertToFormat(QImage::Format_ARGB32) 
than "image.convertDepth(32)"?

> 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?

> More important is they dropped the jump table, which is used a lot. I'm

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.

> really not getting some of these changes... Along with other things being
> dropped Qt4 seems to be getting worse as time goes by.

Because we moved some methods into the Qt3 support block? First of all, there 
is usually an easy replacement for any if them. Second, you can use Qt3 
support methods if you want to. They are part of Qt4 and will be supported 
during it's lifetime. We just recommend not using them for new code (and yes, 
you are free to ignore our recommondation ;-)

Lars

> If TrollTech people are reading this: restore the jump table and not just
> as a Qt3 support method! And box layout widgets while your at it ;-) And
> margins and spacings in GridLayout constructors... and ... sigh.
>
> Obviously, I won't be done by Monday. I'll post when I am.




More information about the kde-core-devel mailing list