[Qt-interest] Always on top, transparent window, no title - Mac OS X

Richard Moe Gustavsen richard.gustavsen at nokia.com
Mon Feb 1 10:32:41 CET 2010


>
> 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?

Yes, setWindowFlags(Qt::WindowStaysOnTopHint) will do that. But when  
calling setWindowFlags(Qt::CustomizeWindowHint) on the line below, you  
clear out WindowStaysOnTopHint as well. Do:

   setWindowFlags(Qt::CustomizeWindowHint |Qt::WindowStaysOnTopHint);

and see if it helps...

-Richard



More information about the Qt-interest-old mailing list