Hello, i need to make my window top level when i need. Code of creating window:
class Application(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, None, Qt.Tool | Qt.FramelessWindowHint)
self.setFocusPolicy(Qt.StrongFocus)
self.setAttribute(Qt.WA_QuitOnClose, True)
And when i need i do:
self.setWindowFlags(Qt.WindowStaysOnTopHint)
But after running this part of code my window hides... I don't know, where is it. But my program doesn't close! Help! How can i make my window top most at need moment?
-
Calling .show() or .raise() on your window should make it top focus.
And from the doc for setWindowFlags():
Note: This function calls setParent() when changing the flags for a window, causing the widget to be hidden. You must call show() to make the widget visible again..
I just wanted to add for anyone else who finds this question that the Qt doc for C++ is a very good resource even when using PyQt, just make sure you point to the version of the Qt C++ doc that applies to your version of PyQt (The latest PyQt is compiled against 4.4 if that is what you are using).
0 comments:
Post a Comment