bool GraphDraw::tryToMakeConnection(const GraphConnectionEndpoint &thisEp) { QPointer<GraphConnection> conn; const auto &lastEp = _lastClickSelectEp; //valid keys, attempt to make a connection when the endpoints differ in direction if (thisEp.isValid() and lastEp.isValid() and //both are valid lastEp.getKey().isInput() != thisEp.getKey().isInput()) //directions differ { try { conn = this->getGraphEditor()->makeConnection(thisEp, _lastClickSelectEp); this->getGraphEditor()->handleStateChange(GraphState("connect-arrow", tr("Connect %1[%2] to %3[%4]").arg( conn->getOutputEndpoint().getObj()->getId(), conn->getOutputEndpoint().getKey().id, conn->getInputEndpoint().getObj()->getId(), conn->getInputEndpoint().getKey().id ))); } catch (const Pothos::Exception &ex) { static auto &logger = Poco::Logger::get("PothosFlow.GraphDraw"); logger.warning("Cannot connect port %s[%s] to port %s[%s]: %s", _lastClickSelectEp.getObj()->getId().toStdString(), _lastClickSelectEp.getKey().id.toStdString(), thisEp.getObj()->getId().toStdString(), thisEp.getKey().id.toStdString(), ex.message()); } //cleanup regardless of failure _lastClickSelectEp = GraphConnectionEndpoint(); this->deselectAllObjs(); } //if this is a signal or slot connection //open the properties panel for configuration if (conn and conn->isSignalOrSlot()) { emit this->modifyProperties(conn); } return bool(conn); }