Hello,
I want to rotate graphicsitems when I right click it. It should rotate progressively i.e for one click the angle with horizontal should be 90 deg, for 2nd click it should be 180(with horizontal) and so on.
But it doesn't clear the area (occupied by it before rotation ) when the angle is 270 or 90 and then it is right clicked. It looks as though two items are present. I tried by adding calls to update manually, but in vain.
What am I doing wrong ? :confused:
Please help me solve this.
Code:
#include <QtGui> { public: { setFlags(ItemIsMovable | ItemIsSelectable | ItemIsFocusable); } { if(e->buttons() & Qt::RightButton) rotate(90); scene()->update(br); } { p->drawLine(-18, -9, 18, -9); p->drawLine( 18, -9, 18, 9); p->drawLine( 18, 9,-18, 9); p->drawLine(-18, 9,-18, -9); p->drawLine(-30, 0,-18, 0); p->drawLine( 18, 0, 30, 0); } { } }; int main(int argc, char *argv[]) { Rotor *r = new Rotor(&scene); r->setPos(125,125); r = new Rotor(&scene); r->setPos(57,75); view->show(); return app.exec(); }