【发布时间】:2015-01-08 10:51:36
【问题描述】:
我正在尝试使用 QGraphicsProxyWidget 执行一些动画,但没有看到任何正在应用的动画。例如,如果我只想旋转 QGraphicsTextItem,则此代码有效:
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_);
然而这实际上似乎并没有做任何事情:
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).
有什么建议吗?
【问题讨论】:
标签: c++ qt qgraphicsview qt4.7