Mar-21-2017, 12:32 PM
Hi.
I am making gui application using Qt4, but the whole signals and slots thing seems way too complex, so I suspect it is my coding. But it appears that using the new signals and slots method, I can't work out how to actually connect to a method directly, I seem to always have to go through another method first, otherwise I get a:
Here is an example:
There must be a better more compact way of doing this?
I am making gui application using Qt4, but the whole signals and slots thing seems way too complex, so I suspect it is my coding. But it appears that using the new signals and slots method, I can't work out how to actually connect to a method directly, I seem to always have to go through another method first, otherwise I get a:
bool has no attribute 'whatever'When I haven't actually coded a single boolean variable in the whole application.
Here is an example:
class MainUiWindow( QtGui.QMainWindow ): def __init__(self, parent = None): super(MainUiWindow, self).__init__(parent) def exampleMethod( self ): self.example = aWidget() self.example.show() self.example.ui_okbtn_act.clicked.connect(self.pointlessMethod) def pointlessMethod( self ): UiWidget.wantedMethod() class UiWidget( object ): def wantedMethod( self ): print('Hello World')This seems all very good and well untill you have a few things, so now I have 13 methods in my main window class, 5 of these are purely methods that go from the button click to the method I want to use as a result of the button click.
There must be a better more compact way of doing this?