Maemo 5 Stacked Window Example Revision 313661333563 (Tue Jan 12 2010 at 10:07) - Diff Link to this snippet: https://friendpaste.com/3ShZGYNMUJQTYHf0lV9LI0 Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 1234567891011121314151617181920212223242526272829303132333435363738394041# Author: Tomi Saarinen, Rohea Oy# License: Do what you feel like but we guarantee nothing.import sysfrom PySide.QtCore import *from PySide.QtGui import *class StackedWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) # This attribute makes the whole Stacked Window thing work self.setAttribute(Qt.WA_Maemo5StackedWindow) # Create button and layout self.cw = QWidget(self) self.setCentralWidget(self.cw) self.vbox = QVBoxLayout(self.cw) self.button = QPushButton(self) self.button.setText(QString("Push me")) self.vbox.addWidget(self.button) # Create subwindow self.subWindow = SubWindow(self) # Hide subwindow at first self.subWindow.hide() # Connect button to signal self.connect(self.button, SIGNAL("clicked()"), self.subWindow.show)class SubWindow(QMainWindow): def __init__(self, parent): # Notice that you must give a parent window as parameter to the constuctor QMainWindow.__init__(self, parent) # Also set the Stacked Window parameter for every subwindow in the stack self.setAttribute(Qt.WA_Maemo5StackedWindow) # Just some content... self.label = QLabel(self) self.label.setText(QString("This is a second window in the stack")) self.setCentralWidget(self.label)if __name__ == '__main__': app = QApplication(sys.argv) sw = StackedWindow() sw.show() sys.exit(app.exec_())