Results 1 to 2 of 2

Thread: Scale individual QGraphicsItem's size and position

  1. #1
    Join Date
    Dec 2011
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Scale individual QGraphicsItem's size and position

    I have one question for all, regarding QGraphicsPolygonItem scaling size and position.

    On my scene located many different QGraphicsItem's and QGraphicsWidget (editor for them) also.
    When user want to edit QGraphicsItem's he must select them and press Edit button. QGraphicsWidget create copy of them and show it on its surface.
    Optional, user can zoom in/out those shapes which located on QGraphicsWidget only (not for all scene).

    Every QGraphicsItems is selectable and movable and consist QGraphicsPolygonItem with data:

    Example:
    Qt Code:
    1. p1 << QPointF(-4, 32) << QPointF(-4, -32) << QPointF(4, -32) << QPointF(4, 32);
    To copy to clipboard, switch view to plain text mode 

    So , User can select and move items and then say - Zoom In.
    When I try to scale it ( setScale(2) ) size of item scaled but position not.
    How to scale it's position too ?

    I have read a lot of documentation about QTransform and found QTransform.translate could help me.
    But how to calculate QTransform matrix for current item position ?

    Thank you for any help

    p.s
    Qt 4.6.3, g++ 4.4.3, Linux
    Last edited by klep; 17th December 2011 at 05:50. Reason: updated contents

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Scale individual QGraphicsItem's size and position


Similar Threads

  1. Replies: 1
    Last Post: 29th September 2011, 07:51
  2. QGraphicsItem scale problem
    By qlands in forum Qt Programming
    Replies: 5
    Last Post: 9th June 2010, 16:43
  3. Scale independent QGraphicsItem
    By Twoslick in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2010, 05:59
  4. Scale size of QGraphicsItem without scaling pen width
    By Lodorot in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2009, 00:18
  5. QGraphicsItem::scale() bug or not ?
    By Gopala Krishna in forum Qt Programming
    Replies: 7
    Last Post: 20th June 2007, 15:44

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.