Results 1 to 2 of 2

Thread: Inheriting from QGraphicsSvgItem and QGraphicsLayoutItem

  1. #1
    Join Date
    Jan 2009
    Location
    Czech Republic
    Posts
    26
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Inheriting from QGraphicsSvgItem and QGraphicsLayoutItem

    Hi,
    I sub-classed QGraphicsSvgItem and QGraphicsLayoutItem to be able to add svg item easily to layouts. I achieved this general goal, but now I have few problems with functions like setRotation(), setPos(), setTransformOriginPoint() (those are the only three I discovered).
    I should also add that I was inspired by this

    The problems
    1. setRotation(..) - The item is rotated, but somehow when the layout is resized the item is resized in wrong direction (i.e. you rotated some item by 90° now when you increase width of layout the height of the item is stretched instead)
    2. setPos(..) - does not seem to work at all
    3. setTransformOriginPoint(..) - does work only when you change it in paint(..) method itself (Edit: this probably only apply when you set the origin point as boundingRect().center() - the reason is now obvious to me )


    Now, you probably can not help me without source... so, here it is with simple TestCase project
    Attached Files Attached Files
    Last edited by Palmik; 21st February 2010 at 16:46.

  2. #2
    Join Date
    Jan 2009
    Location
    Czech Republic
    Posts
    26
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Inheriting from QGraphicsSvgItem and QGraphicsLayoutItem

    So...
    1. setRotation(..) - I'm still not able to resolve this one
    2. setPos(..) - can by solved with something like setPosAdjustment(..)
    3. setTranformOriginPoint(..) - works


    You probably need to see the source code - here is version with some testcases, do not worry, it's rather short
    I would appreciate any help concerning setRotation(..) and even other things like tips how to improve the current code.
    QGraphicsSvgLayoutItem_.zip
    Last edited by Palmik; 23rd February 2010 at 16:03.

Similar Threads

  1. heightForWidth QGraphicsLayoutItem
    By bunjee in forum Qt Programming
    Replies: 0
    Last Post: 20th October 2009, 09:14
  2. A Object inheriting from QGraphicsLineItem
    By jano_alex_es in forum Newbie
    Replies: 15
    Last Post: 15th July 2009, 09:25
  3. Subclassing QGraphicsTextItem and QGraphicsLayoutItem
    By psih128 in forum Qt Programming
    Replies: 2
    Last Post: 15th October 2008, 20:12
  4. Is it possible to create a QThread without inheriting ?
    By probine in forum Qt Programming
    Replies: 6
    Last Post: 23rd March 2006, 22:51
  5. Inheriting QListViewItem
    By ct in forum Newbie
    Replies: 1
    Last Post: 17th March 2006, 05:52

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.