Blender
Blender

Reputation: 298432

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

My application is an OS lock screen (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...

Upvotes: 2

Views: 1210

Answers (3)

sai
sai

Reputation: 155

inherit Qwidget class with parameter Qt::WindowStaysOnTopHint see below

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

Upvotes: 0

quinmars
quinmars

Reputation: 11573

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.

Upvotes: 2

myeviltacos
myeviltacos

Reputation: 113

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.

Upvotes: 0

Related Questions