Results 1 to 1 of 1

Thread: QTransform + drawLine ?

  1. #1
    Join Date
    Jan 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTransform + drawLine ?

    Hey guys,

    Would anyone know why this works:

    Qt Code:
    1. QPainter painter(obj);
    2. painter.setWorldTransformation(...);
    3. ..
    4. const QTransform & xform = painter.transform();
    5. QPoint pt1 = xform.map(QPoint(x1, y1));
    6. QPoint pt2 = xform.map(QPoint(x2, y2));
    7.  
    8. painter.save();
    9. painter.setWorldTransform(QTransform());
    10. painter.drawLine(pt1, pt2);
    11. painter.restore();
    To copy to clipboard, switch view to plain text mode 
    but doing it directly does not:

    Qt Code:
    1. QPainter painter(obj);
    2. painter.setWorldTransformation(...);
    3. ..
    4. painter.drawLine(x1, y1, x2, y2);
    To copy to clipboard, switch view to plain text mode 
    ?

    I got drawRect to work with this transform, but I cannot get lines to behave. I've been all over the QPainter, QPen, and QTransform docs, but I haven't found anything to explain this.

    Thanks,
    -Chris
    Last edited by jpn; 24th January 2009 at 11:29. Reason: missing [code] tags

Similar Threads

  1. QTransform scaling and translate feature.
    By AmolShinde_8 in forum Qt Programming
    Replies: 1
    Last Post: 18th October 2008, 10:31
  2. Mouse mapping on QTransform problem
    By captchaq in forum Newbie
    Replies: 2
    Last Post: 26th September 2008, 19:11
  3. Perspective correction with QTransform
    By dustparticle in forum Qt Programming
    Replies: 1
    Last Post: 3rd June 2008, 23:01
  4. QTransform vs QMatrix
    By maverick_pol in forum Qt Programming
    Replies: 7
    Last Post: 4th October 2007, 10:53
  5. Painter drawLine doubt
    By arjunasd in forum Qt Programming
    Replies: 5
    Last Post: 24th August 2007, 19:59

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.