4Cm20xVTIaHvVqokpfVv3f changeset

Changeset643239633436 (b)
ParentNone (a)
ab
0+import sys
0+from PySide import QtCore, QtGui
0+
0+class Test(QtGui.QMainWindow):
0+    def __init__(self):
0+        QtGui.QMainWindow.__init__(self)
0+
0+        self.button = QtGui.QPushButton(self)
0+        self.button.setText(QtCore.QString("Push me")) 
0+        self.setCentralWidget(self.button)
0+
0+        self.secondWindow = QtGui.QMainWindow(self)
0+        self.secondWindow.setParent(self)
0+
0+        self.connect(self.button, QtCore.SIGNAL("clicked()"), self.openSecondWindow)
0+
0+    def openSecondWindow(self):
0+        print "Activate second window"
0+        self.secondWindow.show()
0+
0+if __name__ == '__main__':
0+    app = QtGui.QApplication(sys.argv)
0+    test = Test()
0+    test.show()
0+    sys.exit(app.exec_())
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- Revision None
+++ Revision 643239633436
@@ -0,0 +1,25 @@
+import sys
+from PySide import QtCore, QtGui
+
+class Test(QtGui.QMainWindow):
+ def __init__(self):
+ QtGui.QMainWindow.__init__(self)
+
+ self.button = QtGui.QPushButton(self)
+ self.button.setText(QtCore.QString("Push me"))
+ self.setCentralWidget(self.button)
+
+ self.secondWindow = QtGui.QMainWindow(self)
+ self.secondWindow.setParent(self)
+
+ self.connect(self.button, QtCore.SIGNAL("clicked()"), self.openSecondWindow)
+
+ def openSecondWindow(self):
+ print "Activate second window"
+ self.secondWindow.show()
+
+if __name__ == '__main__':
+ app = QtGui.QApplication(sys.argv)
+ test = Test()
+ test.show()
+ sys.exit(app.exec_())