Results 1 to 4 of 4

Thread: coordinating system

  1. #1
    Join Date
    Nov 2006
    Posts
    96

    Default coordinating system

    Hi. I want to implement the coordinate system like in math where there would be a rectangle with 4 corners:
    - the first corner would be (0,0) --> left+down
    - the second --> (0,1) --> right + down
    - third --> (1,0) --> left + up
    - forth --> (1,1) --> right + up
    ----> that is what the coordinate system looks like in math

    But in programming it's not like that. I need a way to make this possible. Any ideas?

    I'm using QPainter class. I tried like this:

    Qt Code:
    1. //move the coording system to the (WIDTH,HEIGHT)
    2. painter.translate(WIDTH,HEIGHT);
    3. //rotate the coordinating system for 180 degrees
    4. painter.rotate(180);
    5. //sets the painter's window to the rectangle beginning at (x, y) and the given width and height.
    6. painter.setWindow(0,0,WIDTH,HEIGHT);
    To copy to clipboard, switch view to plain text mode 
    but it's not exactly what I want...

    I need some suggestions how to make this possible.

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

    Default Re: coordinating system

    Quote Originally Posted by eleanor View Post
    painter.rotate(180);
    Unfortunately this won't work, you have to flip the Y axis using scale( -1, 1 ).

  3. #3
    Join Date
    Nov 2006
    Posts
    96

    Default Re: coordinating system

    Can you be more specific, I don't know what you mean.

    And I've tried painer.scale(-1,1) and doesn't help with my problem?

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

    Default Re: coordinating system

    You need:
    Qt Code:
    1. painter.setWindow( 0, 0, WIDTH, HEIGHT );
    2. painter.scale( 1.0, -1.0 );
    3. painter.translate( 0.0, -HEIGHT );
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QSkinWindows Classes
    By kernel_panic in forum Qt-based Software
    Replies: 45
    Last Post: 20th April 2010, 12:35
  2. copy and run a .exe file in another system
    By sabeesh in forum Installation and Deployment
    Replies: 3
    Last Post: 22nd August 2007, 10:05
  3. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  4. Qt4 and system locale
    By L.Marvell in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2007, 13:00
  5. System title bar height
    By andynugent in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th October 2006, 15:57

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.