开发者

Qt - Catch events normally handled by the Window Manager

开发者 https://www.devze.com 2023-03-12 10:19 出处:网络
I\'m not sure quite how to phrase the question concisely, so if there is a similar question, please point me in the right direction and close this one.

I'm not sure quite how to phrase the question concisely, so if there is a similar question, please point me in the right direction and close this one.

I am currently building a CAD app, the user interacts within the 3D viewports primarily through the mouse and the three keyboard modifiers (alt, shift, ctrl). Shift and control modify the currently selected tool options, and alt operates the camera - much like any other 3D CAD app.

However I'm currently developing with a Gnome desktop, and it's window manager (AFAIK) catches any Alt-RightButton mouse dragging events and interprets them as a window drag command - even when not holding the title bar and regardless of the currently highlighted widget.

This is a disaster for me because camera keyboard controls are quite standardised in my target industry. So does anyone know o开发者_高级运维f a way to override this behaviour, preferably from within Qt, and preferably focus it for my one scenario in one particular widget class?

Thank you,

Cam


If you use the Qt::X11BypassWindowManagerHint on the window, then the window manager can't steal your keypresses. However, this means you lose the native window frame (including decoration, moving, and resizing), so it is likely you don't want to do this.

Another way: if your users are only on 1 or 2 varieties of Linux, add something to the installer which asks the user whether they want to manipulate the gnome (or whatever) keysettings, and if so, changes them via gconftool-2 (or equivalent).

0

精彩评论

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