PDA

View Full Version : QPainter::rotate problem in QGraphicsItem



alizadeh91
11th March 2012, 10:29
When i draw a pixmap in QGraphicsItem by painter and then rotate it, it won't erase previous state ! :S

there is an attachment.(there is dial i want to rotate needle but you see what happens!)7486

wysota
11th March 2012, 11:51
Show us your code please.

Aruz
23rd August 2012, 22:02
I have same problem. How can I rotate a widget which on another widget? This is my code:


..
QGraphicsScene *scene = new QGraphicsScene(ui->gemiSekme);
QGraphicsItem *item = new QGraphicsItem(ui->label_2);
item->rotate(45);
scene->addItem(item);
ui->graphicsView->setScene(scene);
I get this error:

error: cannot allocate an object of abstract type 'QGraphicsItem'
Also I tried this code, does not run.

..
QGraphicsScene scene;
QGraphicsProxyWidget *proxy = scene.addWidget(ui->label_2);
proxy->rotate(20);
ui->graphicsView->setScene( &scene);
ui->graphicsView->show();
Thanks for your time.