Hi
What I've done to solve this problem
Note: myGraphicsView->initialScale is != to 1.f in my application but for most of code, you can replaced it by 1;
{
myGraphicsView = _myGraphicsView;
connect(myGraphicsView ,SIGNAL(scaleChanged(float)),this,SLOT(parentScaleChanged(float)));
}
void MyItem::parentScaleChanged(float newScale)
{
setScale(myGraphicsView->initialScale/newScale);
}
MyItem::MyItem(QGraphicsView* _myGraphicsView )
{
myGraphicsView = _myGraphicsView;
connect(myGraphicsView ,SIGNAL(scaleChanged(float)),this,SLOT(parentScaleChanged(float)));
}
void MyItem::parentScaleChanged(float newScale)
{
setScale(myGraphicsView->initialScale/newScale);
}
To copy to clipboard, switch view to plain text mode
Bookmarks