Qt 如何使用AnimateImage或其他工具为256色以上(即非GIF)的图像设置动画
我可以在Qt5.9中使用Qt 如何使用AnimateImage或其他工具为256色以上(即非GIF)的图像设置动画,qt,animation,qml,qt5,image-formats,Qt,Animation,Qml,Qt5,Image Formats,我可以在Qt5.9中使用AnimatedImage,它可以在这样的GIF上工作 import QtQuick 2.7 import QtQuick.Controls 2.2 ApplicationWindow { visible: true width: 640 height: 480 Rectangle { width: animation.width; height: animation.height + 8
AnimatedImage
,它可以在这样的GIF上工作
import QtQuick 2.7
import QtQuick.Controls 2.2
ApplicationWindow
{
visible: true
width: 640
height: 480
Rectangle
{
width: animation.width;
height: animation.height + 8
AnimatedImage
{
id: animation;
source: "myanimation.gif"
}
Rectangle {
height: 8
width: animation.currentFrame/animation.frameCount * animation.width
y: animation.height
color: "red"
Component.onCompleted: console.log("framecount ", animation.frameCount);
}
}
}
我也收到了很多错误信息。这是反复印刷的
QQmlExpression: Expression qrc:/main.qml:26:20 depends on non-NOTIFYable properties:
QQuickAnimatedImage::frameCount
我从这里获取了示例代码
它根本不起作用,把frameCount
放进一个属性有点问题,所以我在我的版本中改变了它
我想制作一个png
动画,就像一个apng
。显然,过去有mng
支持,但现在已经没有了
因此我调用QMovie::supportedFormats
,它只返回GIF
(在Windows上)
我的问题:
如何在支持非调色板颜色(如png等)的格式上使用AnimatedImage
,或者是否有其他方法可以为图像设置动画
感谢您提供的任何信息。这些图像格式似乎不是标准安装的Qt/QML附带的。但是,您可以将它们作为插件安装 见: