Hi,

I have the following error when running my C++ code from python.
The C++ code is a multiple inheritance class. It is a worker thread which has to emit events.
Why doesn't this work ?

File "test.py", line 165, in __init__
    self.didSomething.connect(self.handletrigger)
TypeError: pyqtSignal must be bound to a QObject, not 'ImageWriter'

C++ header file:

        class QtWorker: public QObject, public Worker {
        public:
QtWorker(const std::string& name=""): Worker(name), p_widget(0) {}
            virtual ~QtWorker() {}

            QWidget* GetWidget() {return p_widget;}

        protected:
            QWidget* p_widget;
        };


SIP Code:

namespace core
{
    class QtWorker: QObject, core::Worker
    {
%TypeHeaderCode
#include "core/Qtworker.h"
%End
        public:
            QtWorker(const string& name);

            void *GetWidget();

    };
};

Python Code:

class ImageWriter(core.QtWorker):

    didSomething = pyqtSignal()

    def __init__(self):
        super(ImageWriter,self).__init__()
        self.didSomething.connect(self.handletrigger)

    def Process(self):
        self.didSomething.emit()
        return True

    def handletrigger(self):
        print "ImageWriter signal received"

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to