1

I have an ActiveX control in a QAxWidget class and I am trying to connect an Activex Event to a Slot in python

void MoveComplete (int ID) [signal]

The documentation says

QObject::connect(object, SIGNAL(MoveComplete(int)), receiver, SLOT(someSlot(int)));

But when I try run it, I get :

NameError: global name 'MoveComplete' is not defined.

I've also tried running it like this

self.connect(self, QtCore.SIGNAL('MoveComplete(int)'), self, QtCore.SLOT(self.test2()))

But it gets called at the beginning of a function which performs a Movement and not after it has been completed.

How do I connect a slot to this signal?

Shadowzee
  • 512
  • 3
  • 11

1 Answers1

0

I obviously can't test this, and I don't know what documentation you're referring to, but something like this should work in PyQt4:

self.connect(axwidget, QtCore.SIGNAL('MoveComplete(int)'), self.test2)

That is, the first argument is an instance of your QAxWidget class, the second argument is the signal signature, and the last argument is a python callable object (i.e. a function, method, lambda, etc).

Connecting signals in PyQt doesn't always work in the same way as it does in C++. For more details, see Old-style Signal and Slot Support in the PyQt4 docs. The New-style Signal and Slot Support is much more pythonic (and a lot less error-prone) - but I don't know whether it would work with ActiveX controls.

ekhumoro
  • 98,079
  • 17
  • 183
  • 279