我使用 QGraphicsView
, QGraphicsScene
类,以便在这样的小部件中显示图片:
m_Scene->addPixmap(QPixmap(fileName));
m_View->setScene(m_Scene);
如何在同一场景中显示 .gif 动画?
原文由 Narek 发布,翻译遵循 CC BY-SA 4.0 许可协议
我使用 QGraphicsView
, QGraphicsScene
类,以便在这样的小部件中显示图片:
m_Scene->addPixmap(QPixmap(fileName));
m_View->setScene(m_Scene);
如何在同一场景中显示 .gif 动画?
原文由 Narek 发布,翻译遵循 CC BY-SA 4.0 许可协议
http://doc.qt.io/qt-5/qmovie.html
google 和 Qt 文档是你的朋友。甚至还有一个 例子。
PS:除非您在中国,否则无法访问 google,但您会拥有 Bing 和 doc.qt.io.com 之 类的东西。
PS2: for a little more in-depth answer: you can use a QGraphicsProxyWidget
of a QLabel
which has a QMovie
via QLabel::setMovie
.可能有一种更简单/更短的方法来做到这一点。
原文由 rubenvb 发布,翻译遵循 CC BY-SA 3.0 许可协议
3 回答2k 阅读✓ 已解决
4 回答4.4k 阅读✓ 已解决
2 回答3.9k 阅读✓ 已解决
2 回答3.2k 阅读✓ 已解决
1 回答3.2k 阅读✓ 已解决
1 回答2.7k 阅读✓ 已解决
3 回答3.4k 阅读
我不使用
QGraphicsView
或QGraphicsScene
的 GIF 动画,我只在QDialog
中使用它,但我认为这是我的代码, :我的
loading.gif
我从 这个 链接中获取。PS:还检查来自 Qt SDK 的示例。他们真的可以提供帮助!