Results 1 to 12 of 12

Thread: QPainter, scale(), and setFont()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QPainter, scale(), and setFont()

    It might be caused by some rounding errors, since you perform all calculations on integers. Another possibility is that the "active" point of the cursor is in a bit different place than you would expect.

  2. #2
    Join Date
    Oct 2007
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    4

    Default Re: QPainter, scale(), and setFont()

    If rounding errors were indeed the case, then (and that seems to make sense), how could I best circumvent the problem? I can use floats instead of integers, but I can only use QPainter::setWindow() with a QRect, not a QRectF, and this seems to be the underlying hindrance since I set the QTransform with a call to QPainter::combinedTransform() shortly thereafter.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QPainter, scale(), and setFont()

    Quote Originally Posted by c_07 View Post
    but I can only use QPainter::setWindow() with a QRect, not a QRectF
    Yes, but you can avoid some of the errors by changing QRectF to QRect in the last step before the call to setWindow().

    QTransform uses floats internally, so first I would check whether mapped_center has correct coordinates and whether changing it to QPointF helps.

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
  •  
Qt is a trademark of The Qt Company.