为什么我无法在分辨率为800x600的显示器上运行Qt Qml应用程序?

时间:2016-09-22 09:59:12

标签: linux qt opengl qml xcb

当我将分辨率设置为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应用程序时,应用程序运行正常。

  • 系统:Archlinux 4.7.4-1-ARCH x86_64 GNU / Linux
  • Qt:QMake 3.0版使用Qt 5.7.0版本
  • libxcb:libxcb 1.12-1

它似乎是Qt bug或xcb库错误。

UPD:我在bugreports.qt.io中创建了a bug report

此效果仅适用于Qt Quick Controls 2应用程序

1 个答案:

答案 0 :(得分:1)

如果删除下一行代码(在main.cpp中),则不会再现此效果:

QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);