Results 1 to 15 of 15

Thread: Qt Coordinate System and the Graphics View Framework

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: Qt Coordinate System and the Graphics View Framework

    has anyone managed to figure out if there is a good way to rotate/translate the coordinate system so that when drawing angles, zero degrees is up and value increase clockwise instead of zero degrees to the right and values increase counter-clockwise?

  2. #2
    Join Date
    Feb 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Thumbs up Re: Qt Coordinate System and the Graphics View Framework

    I have found the solution.
    Use a QGraphicsItemGroup to contain the text items. Use the group to set coords, scales and rotation. The text items ignores the transformations.
    For example:

    Qt Code:
    1. grp->addToGroup(text);
    2. text->setFont(font);
    3. text->setPos(0,0);
    4. text->setFlag(QGraphicsItem::ItemIgnoresTransformations);
    5. grp->setPos(x,y);
    To copy to clipboard, switch view to plain text mode 


    Pay attention that the text item must be added to group before his setting his coordinates, since coordinates of the sub-item are relative to the parent item, BUT when adding the item to the group his coords relative to the scene are preserved.

    Hope that 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.