[PyQt] sip: Passing C++ QObject subclass as signal argument

Patrick Stinson patrickkidd at gmail.com
Sun Sep 10 01:03:30 BST 2017


Hello!

I have two custom QObject subclasses implemented in C++. I want to pass one of them (FDDocument) as an argument when I emit a signal from the other one (CUtil::fileOpened(FDDocument *)).

Right now the signal is emitted in python but I get a QObject pointer that hasn’t been converted to an FDDocument pointer. Here is my sip code:



%Module _cutil
%Import QtGui/QtGuimod.sip

%ModuleHeaderCode
#include "../_cutil.h"
%End


class FDDocument : QObject {
private:
    FDDocument();
public:
    QByteArray diagramData() const;
    void updateDiagramData(const QByteArray *);
};

class CUtil : QObject {
private:
    CUtil();
public:

    static CUtil *instance();
    
signals:
    void fileOpened(FDDocument *);
};


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170909/ee0802c2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1403 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170909/ee0802c2/attachment.bin>


More information about the PyQt mailing list