можно проще:
C++ (Qt)
static QTransform makeTransform( int f, const QSizeF& objSize );//f - flip flags (fsHorizontal,fsVertical), objSize - the size of QGraphicsItem
QTransform makeTransform( int f, const QSizeF& objSize )
{
FUNC_PREPROCESS;
QTransform res;
qreal fDx = 1., fDy = 1.;
QPointF ptOffset;
if( f & fsHorizontal )//flip by horz
{
fDx = -1;
ptOffset.setX( -objSize.width() );
}
if( f & fsVertical )//flip by vert
{
fDy = -1;
ptOffset.setY( -objSize.height() );
}
res.scale( fDx, fDy );
res.translate( ptOffset.x(), ptOffset.y() );
return res;
}
//usage
extern QGraphicsItem* pItm;
QTransform t = makeTransform( fsHorizontal | fsVertical, pItm->boundingRect().size() );
pItm->setTransform( t );