[Interest] Replacement for Qt4 QMatrix4x4?

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Fri Feb 22 11:21:52 CET 2019

Il 21/02/19 22:47, Matthew Woehlke ha scritto:
> So... after a full day of debugging, trying to port my Qt4 app to Qt5
> and chase down a nasty case of stack clobbering, I discovered that the
> problem is that QMatrix4x4 changed from qreal to float.
> (Uh...why? I am not particularly amused by the loss of precision, nor
> the extremely subtle incompatibility.)

IIRC the idea in Qt 5 was that:

* QMatrix, QTransform, QPointF, QRectF and so on were "raster engine" 
(aka CPU-rasterizer) datatypes, therefore using qreal (so either double 
or float depending on how you build Qt);

* QMatrix4x4, QVectorND and so on were types for OpenGL integration, 
therefore only using float.

The fact that you can use QMatrix4x4 on a QPointF is IMNSHO an API 
mistake. The two shouldn't mix together "transparently", if the 
intention is the one above.

> Alas, there does not seem to be any feasible replacement in Qt. I can't
> use QGenericMatrix because it can't be used to transform QPointF's, nor
> can it be inverted, both of which are features I require. I*really*
> don't want to throw out the precision of double, especially as I have
> tons of other code that still uses double and would have to wade through
> mountains of conversion warnings to do so.
> Am I missing something, or do I need to drag in Eigen?

You're not missing anything. But maybe you can use something simpler, 
like GLM's dmat4?

My 2 c,
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190222/6470bc7e/attachment.bin>

More information about the Interest mailing list