#include //-------------------------------------------------------- int main( int argc, char *argv[] ) { QApplication app( argc, argv ); QGraphicsScene scene( 0, 0, 400, 400 ); scene.setBackgroundBrush( Qt::white ); QPen pen( Qt::black ); pen.setWidth( 1 ); QBrush br( Qt::white ); QGraphicsRectItem* item1 = scene.addRect( 120.0, 100.0, 80.0, 80.0, pen, br ); item1->setFlags( QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable ); item1->setTransformOriginPoint( QPointF( 50.0, 50.0 ) ); item1->setRotation( 45.0 ); QGraphicsRectItem* item2 = scene.addRect( 220.0, 100.0, 80.0, 80.0, pen, br ); item2->setFlags( QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable ); item2->setTransformOriginPoint( QPointF( 50.0, 50.0 ) ); item2->setRotation( 45.0 ); QGraphicsView window( &scene ); window.resize( 400, 400 ); window.show(); return app.exec(); }