开发者

Qt4: Making fullscreen window impossible to get around (a lock screen)?

开发者 https://www.devze.com 2023-03-22 02:42 出处:网络
My application is an OS lock screen开发者_Python百科 (like GDM\'s lock screen or KDE\'s), so I\'m trying to make it function like one.

My application is an OS lock screen开发者_Python百科 (like GDM's lock screen or KDE's), so I'm trying to make it function like one.

I am trying to make my application's window hover above all other windows and disable/intercept all keyboard shortcuts (ALT-TAB, CTRL-ALT-D, etc.) that would cause it disappear.

Is there any way to do this? I'm 100% sure there is, as lock screens with GUIs exist, but I just can't find the place to look...


I don't know how to do it with Qt, but what you are looking for is called grabbing. You can grab the pointer input device as well as the keyboard.

Edit: Looking in to the Qt4 docs, have you tried to use QWidget::grabMouse? It looks like this function does exactly what you want.


I don't know if this is the best solution, but you can try an event handler using QObject::installEventFilter().

If you are using Windows, you can install an event filter that handles messages where event->type() == QEvent::WinEventAct.

I don't really know much about other OSs, but Qt probably has something for that too.


inherit Qwidget class with parameter Qt::WindowStaysOnTopHint see below

myclass::myclass(QWidget *parent) : QWidget(parent,Qt::WindowStaysOnTopHint)
0

精彩评论

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