GIF animation in Qt(Qt中的GIF动画)
问题描述
我使用了 QGraphicsView、QGraphicsScene 类来在这样的小部件中显示图片:
I have used QGraphicsView, QGraphicsScene classes in order to show a picture in a widget like this:
m_Scene->addPixmap(QPixmap(fileName));
m_View->setScene(m_Scene);
如何在同一场景中显示 .gif 动画?
How I can show .gif animation in the same scene?
推荐答案
我不将 GIF 动画与 QGraphicsView 或 QGraphicsScene 一起使用,我只在 中使用它>QDialog,但我认为这是相同的东西,所以这是我的代码:
I don't use GIF animation with QGraphicsView or QGraphicsScene, I use it only in QDialog, but I think it's the same stuff, so here is my code:
QMovie *movie = new QMovie(":/images/other/images/16x16/loading.gif");
QLabel *processLabel = new QLabel(this);
processLabel->setMovie(movie);
movie->start();
我的 loading.gif 我取自 this 链接.
My loading.gif I took from this link.
PS:还可以查看 Qt SDK 中的示例.他们真的能帮上忙!
PS: also check the examples from Qt SDK. They are really can help!
这篇关于Qt中的GIF动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Qt中的GIF动画
基础教程推荐
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- CString 到 char* 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
