2015-01-08 7 views
0

QGraphicsProxyWidget을 사용하여 일부 애니메이션을 수행하려고하는데 적용되는 애니메이션이 보이지 않습니다.QGraphicsProxyWidget 애니메이션이 작동하지 않습니다.

 QGraphicsView *view_ = new QGraphicsView(this);   
     QGraphicsScene *scene_ = new QGraphicsScene(view); 
QGraphicsTextItem *text_item_ = new QGraphicsTextItem("This is some sample text to\ntest if we can rotate the\nimage correctly"); 
     scene_->addItem(text_item_); 
     text_item_->rotate(180); 
     view->setScene(scene_); 

그러나이 실제로 아무것도 할 것 같지 않습니다 : 내가 원하는 예를 들어 그냥이 코드가 작동하는 QGraphicsTextItem 회전

 QLabel* label = new QLabel(this); 
     label->setText("This is some sample text to\ntest if we can rotate the\nimage correctly"); 
     QGraphicsView *view_ = new QGraphicsView(this);   
     QGraphicsScene *scene_ = new QGraphicsScene(view); 
QGraphicsProxyWidget *proxy_widget_ = new QGraphicsProxyWidget(); 
     proxy_widget_->setWidget(label); 
     scene_->addItem(proxy_widget__); 
     proxy_widget_->rotate(180); 
     view->setScene(scene_); 

을하지도 같이 그 일을 않습니다

QGraphicsProxyWidget *proxy_widget_ = scene_->addWidget(label). 

제안 사항이 있으십니까?

답변

0

감사합니다. Merlin. 문제를 파악했습니다. QLabel에서 육아를 제거하면 작동합니다.

그래서이를 변경 :

QLabel* label = new QLabel(this); 

을이 사람 :

QLabel* label = new QLabel(); 
0

코드는 프록시 위젯을 추가하고 호출합니다 - 당신이 QGraphicsProxyWidget 문서를 보면, 당신이 QGraphicsItem에서 상속 것을 볼 수 있습니다

proxy_widget->rotate(180); 

당신은 기능 setRotation

proxy_widget->setRotation(180); 
에게 전화해야