[Qt-interest] Always on top, transparent window, no title - Mac OS X
John Clayton
johnclayton72 at gmail.com
Fri Jan 29 23:55:26 CET 2010
Hi All,
I'd like to make an 'overlay' window on Mac OS X using Qt, that is
transparent and has no title bar. The window will be used to draw the
outlines of other windows - so it needs to cover/overlay the entire
area of all displays attached to the computer. The outlines of other
windows will be drawn using the standard QPainter calls.
I'd like to know what the best way is to achieve the following:
- fully transparent window
- that stays on top, always - "on top" meaning on the top of all
other windows of any other app
- can be drawn on
- ignores mouse events entirely, mouse events *must* be delivered to
apps underneath this window
- spans the entire display(s)
I've presently got one solution that uses one QWidget per display -
but I can't work out how to make sure that this one window stays on
the very top, all the time. It is transparent. I set it up like this:
MarkerOverlay::MarkerOverlay(QWidget* parent) : super(parent) {
setAutoFillBackground(true);
QPalette pal = this->palette();
pal.setBrush(QPalette::Base, Qt::transparent);
pal.setBrush(QPalette::Window, Qt::transparent);
pal.setBrush(QPalette::Background, Qt::transparent);
this->setPalette(pal);
setWindowFlags(Qt::WindowStaysOnTopHint);
setWindowFlags(Qt::CustomizeWindowHint);
setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute(Qt::WA_DeleteOnClose, false);
setFocusPolicy(Qt::NoFocus);
}
Is there a way to tell Qt to put windows on top of *everything* else,
all the time? I do know how to do this using the Cocoa windows
(setWindowLevel: on the NSWindow instance). Its trivial, I'd just
like to know if there's a way to get this done using Qt.
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100129/d720d23d/attachment.html
More information about the Qt-interest-old
mailing list