nodeeditor
nodeeditor copied to clipboard
Get Warning "qt.core.qobject.connect: QObject::connect: signal not found in NodeDelegateModel" while using load *.dll method.
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<NodeDelegateModel> 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.
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;
};`
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.