当我将分辨率设置为800x600时,我的应用程序崩溃并出现以下错误:
QXcbConnection: XCB error: 2 (BadValue), sequence: 460, resource id: 0, major code: 1 (CreateWindow), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 461, resource id: 37748745, major code: 2 (ChangeWindowAttributes), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 462, resource id: 37748745, major code: 18 (ChangeProperty), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 463, resource id: 37748745, major code: 18 (ChangeProperty), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 464, resource id: 37748745, major code: 18 (ChangeProperty), minor code: 0
etc.
但是当我在分辨率为1920x1080(或任何其他大于或等于1024x768)分辨率的显示器上运行Qml应用程序时,应用程序运行正常。
它似乎是Qt bug或xcb库错误。
UPD:我在bugreports.qt.io中创建了a bug report。
此效果仅适用于Qt Quick Controls 2应用程序
答案 0 :(得分:1)
如果删除下一行代码(在main.cpp中),则不会再现此效果:
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);