PDA

View Full Version : QLineF::intersect does not work properly (solved)



jano_alex_es
23rd June 2009, 08:52
Hi... can this be a QT bug? because my code is quite simple and seems like it's not working as expected.

QT Assistant:

IntersectType QLineF::intersect ( const QLineF & line, QPointF * intersectionPoint ) const
Returns a value indicating whether or not this line intersects with the given line.
The actual intersection point is extracted to intersectionPoint (if the pointer is valid). If the lines are parallel, the intersection point is undefined.


My code:


QPointF* pIntersectionPoint = 0;
int test = firstQLineF.intersect(otherQLineF, puntoIntersec);


When the code is executed, test is 1 (not parallel) but the pointer is undefined, the intersection point is not "filled".

any idea? :S

thanks!

jano_alex_es
23rd June 2009, 09:06
I missundertood the help... it says "valid pointer", not "dinamic object pointed by a valid pointer", so the solution was:


QPointF* pIntersectionPoint= new QPointF;