开发者

Qt keyboard events with DirectX fullscreen

开发者 https://www.devze.com 2023-01-31 02:37 出处:网络
I need to display a full screen DirectX window from a Qt app. Although directX isn\'t supported directly anymore by Qt this should be easy enough - just override QWidget, provide your own paintEvent(

I need to display a full screen DirectX window from a Qt app.

Although directX isn't supported directly anymore by Qt this should be easy enough - just override QWidget, provide your own paintEvent() and set a WA_PaintOnScreen attribute.

But when the app is full screen D开发者_开发技巧irectX is grabbing all the mouse and keyboard inputs - so the only way out of the app is ctrl-alt-del.

ps. Even if I wrote DirectX keyboard handlers I would still have to find a way of creating the correct Qkeypress event to pass to Qt.

Has anyone done this? Or is there a simple way to tell DirectX not to grab the keyboard?


To my knowledge Direct3D does not get the keyboard. Your problem more likely arises from the fact that Direct3D in full-screen is quite a different beast. Things like GDI (which Qt may well use to do rendering) do not work by default, the run-time hooks lots of bits of information. That info then, presumably, never manages to get to Qt. The options you have are to re-implement Qt to render using Direct3D (Lighthouse project?) or to use a pseudo full screen. This is usually done by creating a window that has a client area the same size as the screen and then positioning it correctly.

The latter would probably be the simplest solution ...


There was an attempt to get a D3DWidget kind of thing in Qt 4.3-4.5 or something like that, but it never was stabilized or approved and later even removed.

Perhaps indeed lighthouse is an option (with a medium sized amount of work, basically links OS/DX stuff to Qt stuff) or you can take a look at the old direct3D code in older Qt branches. I never used it, and it probably isn't intended to use with recent versions of Qt, but it's better than nothing.

0

精彩评论

暂无评论...
验证码 换一张
取 消