Results 1 to 2 of 2

Thread: Resizable & rotatable GraphicsItem

  1. #1
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Resizable & rotatable GraphicsItem

    I am trying to do an application in which I want to achieve the functionality of rotating and resizing the Graphics Item which is basically a Rectangle drawn using paint.

    I have used following code to achieve this functionality.
    This code is not working correctly when I rotate it and then resize it and then again try to rotate then the centre point will be jumped to another point.

    Find my test code attached herewith.

    Can anyone tell me what is going wrong in my above code and what I should change to make my custom graphics item resizeable & rotatable.
    Attached Files Attached Files
    Make everything Simple yet Powerful

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Resizable & rotatable GraphicsItem

    Don't have time to look at your code, but I suspect you are making a common mistake. When rotating any graphical object (in whatever programming language you choose) the method is three steps: first translate your object so that its center corresponds to the point around which you want to rotate, then rotate the transformed object, then translate its center point back to the original location.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 0
    Last Post: 5th June 2013, 20:32
  2. need advice for GraphicsItem
    By alizadeh91 in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2012, 19:25
  3. GraphicsItem is flickering
    By anafor2004 in forum Qt Programming
    Replies: 3
    Last Post: 30th September 2009, 12:44
  4. GraphicsItem Question
    By cwnelatury in forum Qt Programming
    Replies: 8
    Last Post: 14th May 2009, 21:11
  5. Best way for a graphicsitem to delete itself
    By pherthyl in forum Qt Programming
    Replies: 7
    Last Post: 22nd June 2008, 06:57

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.