简体   繁体   English

需要Qt QPA和X11澄清

[英]Need Qt QPA and X11 clarification

I tried to understand Qts platform handling for hours now, but I dont get it. 我试图理解Qts平台处理了几个小时,但是我不明白。 For my hotkey handling I currently use a mixture of X11extras for getting display, xlib for key conversions and xcb for the Qt native event handling. 对于我的热键处理,我目前使用X11extras进行显示,混合使用xlib进行键转换和xcb进行Qt本机事件处理。 Three libs to link. 三个库链接。 And where does the undocumented QPA play a role here? 无证QPA在这里起什么作用? Now I wonder if this is necessary. 现在我想知道这是否必要。 I need some clarification here. 我需要在这里澄清一下。 I am using qt 5.4. 我正在使用Qt 5.4。 What is the way to go for the future? 未来的路是什么?

For Qt, you shouldn't need to do any native platform coding for key events unless you're using native windows. 对于Qt,除非您正在使用本机窗口,否则您无需为键事件做任何本机平台编码。 Read about QEvent and the event functions in QWidget . 了解有关QEventQWidget的事件函数的信息。

Use QWidget::nativeEvent() or QCoreApplication::installNativeEventFilter() if you need direct access to raw X11 events. 如果您需要直接访问原始X11事件,请使用QWidget :: nativeEvent()QCoreApplication :: installNativeEventFilter() Native event filters at the application level are processed for every event and have more of a performance impact than subclassing QWidget and reimplementing nativeEvent() . 与子类化QWidget和重新实现nativeEvent()相比,在应用程序级别的本机事件过滤器针对每个事件进行处理,并且对性能的影响更大。

Read about QWindow::fromWinId() and QWidget::createWindowContainer() if you need to embed a native window as a child widget. 如果需要将本机窗口作为子窗口小部件嵌入,请阅读有关QWindow :: fromWinId()QWidget::createWindowContainer()

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

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