View Full Version : QT bug? Or win 7?

16th June 2010, 00:32
I have a widget with these flags and attributes:

setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint );
setTransformationAnchor(QGraphicsView::AnchorViewC enter);

To make the window always on top:

setWindowFlags(Qt::FramelessWindowHint | Qt::SubWindow | Qt::WindowStaysOnTopHint);
So when the app runs, the window is on top of every other window, but as soon as I click any other window it goes behind the windowI clicked.
Why this behaviour?

16th June 2010, 01:38
Why did you use Qt::SubWindow? What happens if you omit it?

16th June 2010, 02:46
I use Qt::SubWindow so the widget wont have a icon on the taskbar. The widget is a child of another widget.

16th June 2010, 03:02
Let me guess... if you leave this flag out, the window behaves as expected, right?

17th June 2010, 20:03
No everything continues the same.

17th June 2010, 20:05
So you want the window on top of the Z-order regardless of clicking any other window ?

17th June 2010, 20:47
Does your widget inherit QDialog?

19th June 2010, 02:06
So you want the window on top of the Z-order regardless of clicking any other window ?
Yes. That should work using Qt::WindowStaysOnTopHint. And normally it does.

Does your widget inherit QDialog?
No. It's a QWidget.

I created this app in windows Vista 32bit and never had this trouble. Only after compiling in Windows 7 64bit that this ocurred.

More explanation:
My app has a checkbox to enable/disable Qt::WindowStaysOnTopHint. The first time Qt::WindowStaysOnTopHint is set via setWindowFlags(), if I click any other window, it suddenly goes behind it(almost as if Qt::WindowStaysOnTopHint was removed). But then if I check the control checkbox(triggers a slot that -> setWindowFlags(Qt::WindowStaysOnTopHint)) the widget behaves as expected staying on top of any window.