简体   繁体   English

Qt 应用程序不响应鼠标和键盘事件

[英]Qt application does not respond to mouse and keyboard events

I recently upgraded my application from using a dynamic build of QT to a static.我最近将我的应用程序从使用 QT 的动态构建升级到了 static。 However, ever since the upgrade I am not able to:但是,自从升级以来,我无法:

  • Trigger mouse events: I am not able to click any widget, there is simply no animation (window is static).触发鼠标事件:我无法单击任何小部件,根本没有 animation(窗口是静态的)。
  • Trigger keyboard events: I can not enter a value in the default focused QSpinBox.触发键盘事件:我无法在默认的焦点 QSpinBox 中输入值。

Some remarks:一些备注:

  • When the upgrade was performed, no style was set for the application (however in the dynamic build, there was a style).执行升级时,没有为应用程序设置样式(但是在动态构建中,有样式)。 I fixed this by using application.setStyle("fusion")我通过使用 application.setStyle("fusion") 解决了这个问题
  • I see the cursor of the QSpinBox blinking.我看到 QSpinBox 的 cursor 闪烁。 In my experience this indicates that the GUI-thread is not "stuck" somewhere.以我的经验,这表明 GUI 线程没有“卡在”某处。

I found the problem: the GUI thread was not the main thread (this is also being logged)我发现了问题:GUI线程不是主线程(这也在记录中)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM