Results 1 to 2 of 2

Thread: QLineF::intersect does not work properly (solved)

  1. #1
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default QLineF::intersect does not work properly (solved)

    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:
    Qt Code:
    1. QPointF* pIntersectionPoint = 0;
    2. int test = firstQLineF.intersect(otherQLineF, puntoIntersec);
    To copy to clipboard, switch view to plain text mode 

    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!
    Last edited by jano_alex_es; 23rd June 2009 at 10:09.

  2. #2
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: QLineF::intersect does not work properly

    I missundertood the help... it says "valid pointer", not "dinamic object pointed by a valid pointer", so the solution was:

    Qt Code:
    1. QPointF* pIntersectionPoint= new QPointF;
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Qt4 : QPainter::setRedirected doesn't work
    By Ankitha Varsha in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2008, 18:52
  2. Printing via QPrinter doesnt work
    By mSergey in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2008, 20:00
  3. QActions don't work with menubar hidden
    By Pepe in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 02:04
  4. Change work area OS
    By pakulo in forum Qt Programming
    Replies: 15
    Last Post: 15th May 2007, 08:20
  5. Why can't I make dynamic_cast work properly?
    By pir in forum General Programming
    Replies: 13
    Last Post: 18th July 2006, 17:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.