Results 1 to 8 of 8

Thread: Best place to apply a QMatrix transform to paint() event in an app

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2014
    Posts
    81
    Thanks
    20
    Thanked 9 Times in 9 Posts
    Qt products
    Qt5
    Platforms
    Windows
    Wiki edits
    7

    Default Re: Best place to apply a QMatrix transform to paint() event in an app

    Here's a suggestion: translate that transform to the centre of the viewport. It should look more like a cartesian representation.
    Qt Code:
    1. QPoint viewportCentre = viewport().rect().center();
    2. QTransform::translate( viewportCentre.x(), viewportCentre.y() );
    To copy to clipboard, switch view to plain text mode 

    Make sure you are specifying coordinates in "cartesian" space: +X is to the right, +Y is up.

  2. The following user says thank you to Kryzon for this useful post:

    Caolan O'Domhnaill (13th October 2015)

  3. #2
    Join Date
    Sep 2015
    Posts
    50
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Best place to apply a QMatrix transform to paint() event in an app

    Quote Originally Posted by Kryzon View Post
    Here's a suggestion: translate that transform to the centre of the viewport. It should look more like a cartesian representation.
    Qt Code:
    1. QPoint viewportCentre = viewport().rect().center();
    2. QTransform::translate( viewportCentre.x(), viewportCentre.y() );
    To copy to clipboard, switch view to plain text mode 

    Make sure you are specifying coordinates in "cartesian" space: +X is to the right, +Y is up.


    I got it all to work. Thank you very much!

Similar Threads

  1. Timer event & paint event, priority
    By Teuniz in forum Qt Programming
    Replies: 0
    Last Post: 2nd February 2010, 13:33
  2. Paint event function in key press event
    By soumya in forum Qt Programming
    Replies: 6
    Last Post: 2nd February 2010, 12:40
  3. Replies: 0
    Last Post: 3rd March 2009, 15:38
  4. Where to apply transform? iterm or QPainter?
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2009, 08:40

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.