Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| lwc:programming:python [2020/11/26 22:40] – created John Harrison | lwc:programming:python [2022/12/30 11:58] (current) – John Harrison | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| ==== Example: ==== | ==== Example: ==== | ||
| + | * Assume " | ||
| + | < | ||
| + | self.worker.showDialog.connect(self.showIntroWindow) | ||
| + | </ | ||
| - | Assume " | ||
| - | |||
| - | Then in the view class: | ||
| - | |||
| - | |||
| - | < | ||
| - | self.worker.showDialog.connect(self.showIntroWindow) | ||
| - | </ | ||
| will connect the signal showDialog defined in worker such that when data is emited to showDialog, the method called showIntroWindow in the view class will be called. | will connect the signal showDialog defined in worker such that when data is emited to showDialog, the method called showIntroWindow in the view class will be called. | ||
| Line 21: | Line 17: | ||
| showDialog = QtCore.pyqtSignal(object) | showDialog = QtCore.pyqtSignal(object) | ||
| - | |||
| Note that the view class does not reference any methods in the controller class | Note that the view class does not reference any methods in the controller class | ||
| Then when the controller class wants to change the view it does something like: | Then when the controller class wants to change the view it does something like: | ||
| - | |||
| self.showDialog.emit(True) | self.showDialog.emit(True) | ||
| - | |||
| - | |||
| And the view class will receive this in methodshowIntroWindow which will at that point be called. | And the view class will receive this in methodshowIntroWindow which will at that point be called. | ||
| Line 40: | Line 32: | ||
| So in our example, state = True | So in our example, state = True | ||
| - | \\ | + | ===== Reference ===== |
| - | + | * [[https:// | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||