Created
July 4, 2012 14:37
-
-
Save fmorency/3047689 to your computer and use it in GitHub Desktop.
PySide destroy slot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PySide.QtCore import * | |
from PySide.QtGui import * | |
class MyQWidget(QWidget): | |
def __init__(self, parent=None, wflags=Qt.WindowFlags()): | |
super(MyQWidget, self).__init__(parent, wflags) | |
self.destroyed.connect(self.destroy_slot) | |
@Slot() | |
def destroy_slot(self, obj): | |
print 'Destroying...' | |
@Slot() | |
def other_destroy_slot(obj): | |
print 'Other destroy slot...' | |
if __name__ == '__main__': | |
app = QApplication(sys.argv) | |
main_window = QMainWindow() | |
my_widget = MyQWidget(main_window) | |
my_widget.destroyed.connect(other_destroy_slot) | |
button = QPushButton(main_window) | |
button.setText('Quit') | |
button.clicked.connect(app.exit) | |
main_window.show() | |
app.exec_() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment