I am trying to simulate a mouse click event in Python on the ui.goButton
widget.
Here is what I did:
QtTest.QTest.mouseClick(self.ui.goButton, QtCore.Qt.LeftButton)
Is this the right way to do it? Cause it is not working.
I am trying to simulate a mouse click event in Python on the ui.goButton
widget.
Here is what I did:
QtTest.QTest.mouseClick(self.ui.goButton, QtCore.Qt.LeftButton)
Is this the right way to do it? Cause it is not working.
Based on your reply to the comment, I will answer your question.
Basically signals can be emitted by,
emit signalToBeEmitted()
So, if you want to emit the QPushButton
's clicked()
signal,
you have to inherit the QPushButton
and you can emit the signal like emit clicked()
.
This example will help you in emitting the signals.
But my question is why you want to do that?
By emitting the clicked()
signal, you will in turn call the connect
ed slot.. So why can't you call the slot directly by yourself instead of emitting the signal and then calling the slot..
Remember slots
are just ordinary functions which can be called just like other functions.
Or else, if the slot present in another object which you will connect through the signal, then emit your own signal instead of messing up with the pre-defined ones.
IMHO, Don't emit such pre-defined signals even for the shorter term..
Hope it helps..
Edit:
Oops I didn't see the PyQt. I am used to Qt with C++. I know nothing about Python. But I believe most of the concepts of Qt will remain common. So I will leave my answer as such..