Results 1 to 3 of 3

Thread: Resizing Svg Item

  1. #1
    Join Date
    Jun 2009
    Posts
    29
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Resizing Svg Item

    I am drawing inheriting QGraphicsSvgItem in my class. I have just drawn in the constructor and trying to figure out how to reflect resizing in my drawing.

    Which functions should be used so that after resizing it is update in the scene?

    The code is below:
    Qt Code:
    1. Cup::Cup(const QString &fileCup,Board* parent)
    2. : QGraphicsSvgItem(fileCup,parent)
    3.  
    4. {
    5.  
    6. //scale(0.5 * parent->boundingRect().width(),0.5*parent->boundingRect().height());
    7. setPos(0,0);
    8. setZValue(1);
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 2nd June 2009 at 13:23.

  2. #2
    Join Date
    Dec 2008
    Location
    TaganrogNativelandChehov,Russia
    Posts
    64
    Thanks
    1
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resizing Svg Item

    may be
    void QGraphicsItem:: paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) [pure virtual]

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resizing Svg Item

    From docs of QGraphicsSvgItem-
    Size of the item can be set via the setSize() method or via direct manipulation of the items transformation matrix.
    But I couldnt find setSize() method for QGraphicsSvgItem.

    Also if you are inheriting the item, you must be rendering yourself too ??
    If yes, you can change the boundingRect of the item and draw accordingly. You will need a variable to hold the rect for item.

Similar Threads

  1. ListWidget positions item
    By talex in forum Qt Programming
    Replies: 3
    Last Post: 21st October 2008, 15:16
  2. View, Scene, Item and thread??
    By dungsivn in forum Qt Programming
    Replies: 5
    Last Post: 20th August 2008, 19:21
  3. Item Delegate Painting
    By stevey in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2008, 07:37
  4. QTreeWidget, resizing item and widgets problem
    By The Storm in forum Qt Programming
    Replies: 15
    Last Post: 17th March 2008, 21:20
  5. Replies: 1
    Last Post: 19th April 2007, 22:23

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.