[Qt-interest] Constructing QPolygonF from QRectF yields vertex count of 5...

Glenn Tarbox, PhD glenn at tarbox.org
Fri Jul 10 04:58:06 CEST 2009


I came across this problem when trying to use QTransform::quadToQuad() to
generate a mapping between two rectangular spaces for plotting.

Having QRectF's defining the bounds of both spaces and knowing that
QPolygonF has an overloaded constructor which takes a QRectF, it all seemed
like it would magically work.

Unfortunately, the quadToQuad call fails.  Upon inspection, the issue is
that quadToQuad checks that there are exactly 4 vertices and the polygon
constructed from a rectangle has 5.  I'm not entirely sure why this would be
the case or whether its necessary, but it certainly wasn't obvious.

I can manually construct the polygon from the rectangles or perhaps yank the
redundant vertex... but it seems counter-intuitive.

I'm currently running version:

commit 099a32d121cbc80a1a234c3146f4be9b5237e7e8
Author: Denis Dzyubenko <denis.dzyubenko at nokia.com>
Date:   Thu Jul 2 11:46:42 2009 +0200

of Qt as there is a bug in Qt which causes qt-creator to crash when using
more recent versions.

-glenn

-- 
Glenn H. Tarbox, PhD ||  206-274-6919
http://www.tarbox.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090709/728dc204/attachment.html 


More information about the Qt-interest-old mailing list