That flag is normally something you set for the life of the visibility of the 
widget, since it is a hint to the systems window manager of how to draw 
windows. 
But, you can change the window flags using bitwise operations:

w = QtGui.QDialog()

## set the flag
w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

## toggle on and off each time the flag
# off
w.setWindowFlags(w.windowFlags() ^ QtCore.Qt.WindowStaysOnTopHint)
# on
w.setWindowFlags(w.windowFlags() ^ QtCore.Qt.WindowStaysOnTopHint)

## clear the flag
w.setWindowFlags(w.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)

The downside is that when you change the flag, the widget will become hidden 
again, and you have to show it. So when you tack on a w.show() right after 
setting the flag, you might see a blip.

-- justin



On Feb 1, 2013, at 2:22 AM, šãñ wrote:

> I have set my QFrame Widget window(standalone application) to stay
> always on top by
> 
> self.setWindowFlags(  QtCore.Qt.WindowStaysOnTopHint);
> 
> how should I make it to toggle with some button ?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To post to this group, send email to python_inside_maya@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to