Results 1 to 3 of 3

Thread: How can I do something like QGraphicsItem::setShear?

  1. #1
    Join Date
    Jan 2012
    Posts
    66
    Thanks
    20
    Thanked 2 Times in 2 Posts
    Platforms
    Windows

    Default How can I do something like QGraphicsItem::setShear?

    I'm trying to shear a QGraphicsItem with a custom transformOriginPoint, but there is no QGraphicsItem::setShear (like there is for rotation: QGraphicsItem::setRotation).

    I realize I could create my own transform matrix and use QGraphicsItem::setTransform, but it doesn't seem to take into account the transformOriginPoint, which in my case is not (0,0).

    For example, the following two examples produce completely different behavior:

    Qt Code:
    1. // takes into account the transformOriginPoint
    2. myItem->setRotation(30);
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // does not take into account the transformOriginPoint
    2. QTransform hi;
    3. hi.rotate(30);
    4. myItem->setTransform(hi);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2012
    Posts
    66
    Thanks
    20
    Thanked 2 Times in 2 Posts
    Platforms
    Windows

    Default Re: How can I do something like QGraphicsItem::setShear?

    I must be missing something. There's no setShear function in the docs or in the normal QGraphicsItem source file, yet there is in this version of QGraphicsItem:

    http://qt.gitorious.org/qt/qt/blobs/...aphicsitem.cpp

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I do something like QGraphicsItem::setShear?

    setOriginPoint is equal to translating the transform before doing other transformations and then at the end translating it back.
    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. Replies: 7
    Last Post: 29th November 2010, 19:20
  2. QGraphicsItem is not drawn again?
    By zgulser in forum Qt Programming
    Replies: 12
    Last Post: 19th October 2009, 16:26
  3. Casting QGraphicsItem child from QGraphicsItem
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 29th August 2008, 15:37
  4. Replies: 2
    Last Post: 28th June 2008, 16:31
  5. QGraphicsItem -> boundingRect()
    By harakiri in forum Qt Programming
    Replies: 4
    Last Post: 6th March 2008, 15:02

Tags for this Thread

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.