Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Warning "qt.core.qobject.connect: QObject::connect: signal not found in NodeDelegateModel" while using load *.dll method. #419

Open
sirius-william opened this issue Apr 30, 2024 · 2 comments

Comments

@sirius-william
Copy link

I make a node plugin to extend my application. User can develop their own Node by inheriting 'NodeDelegateModel' class and compile it as SHARED library (*.dll).
The application will load *.dll at the runtime and do the following code to connect signals:
`std::unique_ptr new_node = construct_func();

    id = newNodeId();

    connect(new_node.get(),
            &NodeDelegateModel::dataUpdated,
            [id, this](PortIndex const portIndex) {
                std::cout << "data_update" << std::endl;
                std::unordered_set<ConnectionId> const &connected = connections(id,
                                                                                PortType::Out,
                                                                                portIndex);
                QVariant const portDataToPropagate = portData(id, PortType::Out, portIndex, PortRole::Data);
                for (auto const &cn: connected) {
                    setPortData(cn.inNodeId, PortType::In, cn.inPortIndex, portDataToPropagate, PortRole::Data);
                }
            });
    connect(new_node.get(),
            &NodeDelegateModel::portsAboutToBeDeleted,
            this,
            [id, this](PortType const portType, PortIndex const first, PortIndex const last) {
                portsAboutToBeDeleted(id, portType, first, last);
            });

    connect(new_node.get(),
            &NodeDelegateModel::portsDeleted,
            this,
            &NodeGraphicsModel::portsDeleted);

    connect(new_node.get(),
            &NodeDelegateModel::portsAboutToBeInserted,
            this,
            [id, this](PortType const portType, PortIndex const first, PortIndex const last) {
                portsAboutToBeInserted(id, portType, first, last);
            });

    connect(new_node.get(),
            &NodeDelegateModel::portsInserted,
            this,
            &NodeGraphicsModel::portsInserted);`

*.dll can load correctly.
But after calling 'addNode' or after doing others (maybe not after addNode), I got warning "qt.core.qobject.connect: QObject::connect: signal not found in NodeDelegateModel" 5 times. The node can add into Scene but can not put in right position. I think the signals above are not connected correctly. But why? What should I do while developing the the using loading *dll.

@sirius-william
Copy link
Author

sirius-william commented Apr 30, 2024

My *.dll project is compiled using following header file:
`class Q_DECL_EXPORT NODE_EDITOR_PUBLIC ValueNode : public NodeDelegateModel {

Q_OBJECT

public:
    QString caption() const override;

    QString name() const override;

    unsigned int nPorts(QtNodes::PortType portType) const override;

    NodeDataType dataType(QtNodes::PortType portType, PortIndex portIndex) const override;

    void setInData(std::shared_ptr<NodeData> nodeData, PortIndex const portIndex) override;

    std::shared_ptr<NodeData> outData(const PortIndex port) override;

    QWidget *embeddedWidget() override;
    
private:
    QLineEdit *edit;
};`

@nolankramer
Copy link

Plugins (shared libraries), typically are developed with __declspec(dllimport) as the class attribute - as their headers are never compiled against, so it is assumed their symbols are always imported by the linking program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants