Results 1 to 2 of 2

Thread: qt coordinate system

  1. #1
    Join Date
    Jan 2012

    Default qt coordinate system

    Hi all,

    i downloaded a code from website for a manometer. it is a very lengthy code so i am not posting the entire code. I do not have a very clear concept in coordinate system so some body please explain the following coordinates and how can i relate to the picture i am drawing (manometer). i am pasting parts of the code
    Qt Code:
    1. painter.translate(width() / 2, height() / 2);
    2. painter.scale(side / 335.0, side / 335.0);
    4. static const int scaleTriangle[6] = { -6,141,6,141,0,129 };
    6. painter.drawEllipse(-152,-152,304,304);
    To copy to clipboard, switch view to plain text mode 

    my main doubt is the first two lines what width and height actually mean and why it is getting divided by 2 and then 335 and 335.
    Most of the code contains the dimensions like above and i don't understand those. please somebody explain me little bit and then direct me to the proper documentation.

    thanks in advance,

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: qt coordinate system

    Width and height are the width and height of the widget. The first line moves the origin of the coordinate system of the painter to the centre of the widget. The second line scales the coordinate system so that it has a range of (-335, 335). In the end all operations are done using coordinates ranging from -335 to +335 with the (0,0) located in the middle of the widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.

Similar Threads

  1. QGraphicsScene Coordinate System
    By grayfox in forum Qt Programming
    Replies: 4
    Last Post: 27th February 2016, 21:34
  2. QGraphicsView coordinate system
    By edxxgardo in forum Qt Programming
    Replies: 3
    Last Post: 12th July 2011, 15:38
  3. coordinate system
    By Wojtek.wk in forum Newbie
    Replies: 7
    Last Post: 12th April 2010, 14:47
  4. 2D Graphics on coordinate system
    By soumya in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2009, 07:27
  5. The coordinate system
    By avis_phoenix in forum Qt Programming
    Replies: 1
    Last Post: 28th July 2008, 13:16


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.