如何解决在DelegateModelQML中使用时,显示具有OpenGL效果Dropshadow的图像失败
要针对RaspBerry Pi 3b +交叉编译qt5.12.9,我关注了博客文章https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/ 和https://wiki.qt.io/RaspberryPi2EGLFS。在同步sysroot之前,我还运行过update-rpi。编译成功。我在pi上也支持eglfs。但是至少在某些情况下,我无法使openGl正常工作。我收到此错误和黑屏:
QOpenGLFramebufferObject: Framebuffer incomplete attachment.
QOpenGLShaderProgram: Could not create shader program
shader compilation Failed:
""
QOpenGLShaderProgram::uniformlocation(matrix): shader program is not linked
QOpenGLShaderProgram::uniformlocation(opacity): shader program is not linked
QOpenGLShaderProgram: Could not create shader program
shader compilation Failed:
""
QOpenGLShaderProgram::uniformlocation(matrix): shader program is not linked
QOpenGLShaderProgram::uniformlocation(textureScale): shader program is not linked
QOpenGLShaderProgram::uniformlocation(color): shader program is not linked
QOpenGLShaderProgram::uniformlocation(alphaMin): shader program is not linked
QOpenGLShaderProgram::uniformlocation(alphaMax): shader program is not linked
QOpenGLShaderProgram: Could not create shader program
仅当将项目与来自委托的opengl调用一起使用时,才会出现上述错误:
DelegateModel{
id: mydelegatemodel
model: mymodel
delegate: RoundShadowIcon{
id: item
width: grid.cellWidth;
height: grid.cellHeight;
}
}
GridView{
clip: true
id: grid
anchors.fill: parent
cellWidth: 100
cellHeight: 100
model: mydelegatemodel
}
RoundShadowIcon.qml:
import QtQuick 2.12
import QtGraphicalEffects 1.12
Item {
Image {
id: face
source: "file:///usr/local/qt5pi/examples/myapp/cache/someimage.png"
sourceSize: Qt.size(parent.width,parent.height)
width: parent.width
height: parent.height
fillMode: Image.PreserveAspectCrop
smooth: true
visible: false
}
Rectangle{
id: mask
anchors.fill: parent
radius: main.radius_
visible: false
}
OpacityMask {
id: round
anchors.fill: face
source: face
maskSource: mask
}
DropShadow {
id: shadow
anchors.fill: parent
horizontalOffset: 0
verticalOffset: 0
radius: 12.0
samples: 17
source: round
}
}
独立运行。这是Qt中的错误吗? 在RaspBerry Pi 3b +上使用qt5.12.9进行了测试。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。