Pārlūkot izejas kodu

修复起始节点的多余连接线问题;
禁用删除连接线操作;
不画连接线端点;

chengxr 1 gadu atpakaļ
vecāks
revīzija
3f0066ae69

+ 1 - 1
QFD/shemeFlow/FlowTemplateDataModel.h

@@ -506,7 +506,7 @@ public:
 
     QString name() const override { return QString("FlowCommonData"); }
 
-    unsigned int nPorts(PortType const) const override { return 2; }
+    unsigned int nPorts(PortType const) const override { return 0; }
 
     NodeDataType dataType(PortType const, PortIndex const) const override { return FlowCommonData().type(); }
 

+ 5 - 4
QFD/widgets/SchemeFlowWidget.cpp

@@ -181,9 +181,10 @@ void SchemeFlowWidget::refresh()
 {
     clearAllNodes();
 
-    int y         = 0;   // 流程图节点位置
-    int space     = 50;  // 流程图节点间距
-    NodeId lastId = -1;
+    int y            = 0;   // 流程图节点位置
+    int space        = 50;  // 流程图节点间距
+    NodeId invalidId = 999;
+    NodeId lastId    = invalidId;
 
     QList<SchemePlanManager::SchemeProcessInfo> scheme = schemeTemplate(m_proj->id, m_indexType);
     for (int i = 0; i < scheme.count(); i++) {
@@ -197,7 +198,7 @@ void SchemeFlowWidget::refresh()
             m_graphModel->setNodeData(id, NodeRole::Caption, SchemePlanManager::processName(process));
         }
         m_graphModel->setNodeData(id, NodeRole::Widget, QVariant::fromValue(w));
-        if (lastId >= 0) {
+        if (lastId < invalidId) {
             m_graphModel->addConnection(ConnectionId { lastId, 0, id, 0 });
         }
 

+ 2 - 1
QtNodes/src/ConnectionPainter.cpp

@@ -1,4 +1,4 @@
-#include "ConnectionPainter.hpp"
+#include "ConnectionPainter.hpp"
 
 #include <QtGui/QIcon>
 
@@ -292,6 +292,7 @@ void ConnectionPainter::paint(QPainter *painter, ConnectionGraphicsObject const
 #endif
 
     // draw end points
+    return;
     auto const &connectionStyle = QtNodes::StyleCollection::connectionStyle();
 
     double const pointDiameter = connectionStyle.pointDiameter();

+ 1 - 1
QtNodes/src/GraphicsView.cpp

@@ -261,7 +261,7 @@ void GraphicsView::setupScale(double scale)
 
 void GraphicsView::onDeleteSelectedObjects()
 {
-    nodeScene()->undoStack().push(new DeleteCommand(nodeScene()));
+    //    nodeScene()->undoStack().push(new DeleteCommand(nodeScene()));
 }
 
 void GraphicsView::onDuplicateSelectedObjects()