PDA

View Full Version : Resizing Svg Item



A.H.M. Mahfuzur Rahman
2nd June 2009, 11:22
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:


Cup::Cup(const QString &fileCup,Board* parent)
: QGraphicsSvgItem(fileCup,parent)

{

//scale(0.5 * parent->boundingRect().width(),0.5*parent->boundingRect().height());
setPos(0,0);
setZValue(1);

}

kwisp
2nd June 2009, 14:23
may be
void QGraphicsItem:: paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) [pure virtual]

aamer4yu
3rd June 2009, 05:35
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.