分类: Qt

15 篇文章

QML Image 不平滑
也许你开启了图像的抗锯齿和平滑过后,图像的边缘还是不太顺滑,你可以设置mipmap这个属性让图像的边缘变得顺滑 比如这样: Image { id: bgImg anchors.fill: parent smooth: true antialiasing: true mipmap: true fillMode: Image.PreserveAspec…
QML中获取已经改变的值
Rectangle { width: 100 height: 100 property int myValue: 0 onMyValueChanged: { console.log("myValue changed from", PropertyChanges(myValue).from, "to", myValue) } MouseArea { …
Qt creator 头文件警告
首先你要添加include_directories([路径])到你的 CMakeLists.txt里 如果仍然有警告,那就需要检查下include_directories指令的位置了,这样: include_directories指令应该被添加在qt_add_qml_module(project)后面,这样才能让你的头文件和你的项目正确的关联
QML qrc unavailable错误
事实上如果你正在使用cmake,并且已经将其加入到executable里,但还是找不到qrc里的东西,那么很可能是你没有开启autorcc和automoc。 下面的代码展示了如何开启它 set(CMAKE_AUTORCC ON) set(CMAKE_AUTOMOC ON)
Qt OpenGL 学习笔记 – 1
Why OpenGL Q: 为什么要使用OpenGL呢,用QPainter不好吗,在QOpenGLWidget里QPainter还可以有GPU加速呢。 A(ChatGPT): QPainter在QOpenGLWidget中确实可以使用GPU来加速渲染,但是它的性能可能不如直接使用OpenGL。因为QPainter在绘制时会经过多个抽象层,涉及到更多…