PySide.QtCore.Qt.WindowModality

This enum specifies the behavior of a modal window. A modal window is one that blocks     input to other windows. Note that windows that are children of a modal window are not blocked.

The values are:

Constant    Description
Qt.NonModal The window is not modal and does not block input to other windows.
Qt.WindowModal  The window is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows.
Qt.ApplicationModal The window is modal to the application and blocks input to all windows.

Demo

from PySide import QtCore, QtGui
class Widget(QtGui.QWidget):
    def __init__(self, parent=None):
        super(Widget, self).__init__(parent)

    def mousePressEvent(self, evt):
        self.w = QtGui.QWidget()
        #self.w.setWindowModality(QtCore.Qt.NonModal)
        self.w.setWindowModality(QtCore.Qt.WindowModal)
        #self.w.setWindowModality(QtCore.Qt.ApplicationModal)
        self.w.show()

if __name__ == '__main__':
    import sys
    app = QtGui.QApplication(sys.argv)
    w = Widget()
    w.show()
    sys.exit(app.exec_())

你可能感兴趣的:(PySide.QtCore.Qt.WindowModality)