|
|
@@ -650,11 +650,13 @@ public: |
|
|
int column, |
|
|
int column, |
|
|
const QPointF ¢er, |
|
|
const QPointF ¢er, |
|
|
bool show_label, |
|
|
bool show_label, |
|
|
std::string branch_expression_id = {}) |
|
|
|
|
|
|
|
|
std::string branch_expression_id = {}, |
|
|
|
|
|
bool branch_active = false) |
|
|
: rung_id_(rung_id), |
|
|
: rung_id_(rung_id), |
|
|
branch_expression_id_(std::move(branch_expression_id)), |
|
|
branch_expression_id_(std::move(branch_expression_id)), |
|
|
column_(column), |
|
|
column_(column), |
|
|
show_label_(show_label) |
|
|
|
|
|
|
|
|
show_label_(show_label), |
|
|
|
|
|
branch_active_(branch_active) |
|
|
{ |
|
|
{ |
|
|
setPos(center); |
|
|
setPos(center); |
|
|
setFlag(ItemIsSelectable, true); |
|
|
setFlag(ItemIsSelectable, true); |
|
|
@@ -686,6 +688,14 @@ public: |
|
|
painter->setPen(QPen(kSelectionBorderColor, 1.4, Qt::DashLine)); |
|
|
painter->setPen(QPen(kSelectionBorderColor, 1.4, Qt::DashLine)); |
|
|
painter->drawRect(boundingRect().adjusted(3, 3, -3, -3)); |
|
|
painter->drawRect(boundingRect().adjusted(3, 3, -3, -3)); |
|
|
} |
|
|
} |
|
|
|
|
|
if (!branch_expression_id_.empty()) |
|
|
|
|
|
{ |
|
|
|
|
|
// 选中补线格时仍需把结构横线绘制在选框上层 |
|
|
|
|
|
painter->setPen(ladderPen(branch_active_)); |
|
|
|
|
|
painter->drawLine( |
|
|
|
|
|
QPointF(-kCellWidth / 2.0, 0), |
|
|
|
|
|
QPointF(kCellWidth / 2.0, 0)); |
|
|
|
|
|
} |
|
|
if (show_label_) |
|
|
if (show_label_) |
|
|
{ |
|
|
{ |
|
|
painter->setPen(kPlaceholderColor); |
|
|
painter->setPen(kPlaceholderColor); |
|
|
@@ -708,6 +718,7 @@ private: |
|
|
std::string branch_expression_id_; |
|
|
std::string branch_expression_id_; |
|
|
int column_ = 0; |
|
|
int column_ = 0; |
|
|
bool show_label_ = false; |
|
|
bool show_label_ = false; |
|
|
|
|
|
bool branch_active_ = false; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class LogicEditorWidget::VerticalConnectorItem final : public QGraphicsItem |
|
|
class LogicEditorWidget::VerticalConnectorItem final : public QGraphicsItem |
|
|
@@ -1046,7 +1057,8 @@ RenderResult renderExpression( |
|
|
+ (static_cast<qreal>(column) + 0.5) * kCellWidth, |
|
|
+ (static_cast<qreal>(column) + 0.5) * kCellWidth, |
|
|
branches[index].output.y()), |
|
|
branches[index].output.y()), |
|
|
false, |
|
|
false, |
|
|
expression.children[index].id)); |
|
|
|
|
|
|
|
|
expression.children[index].id, |
|
|
|
|
|
branch_active)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return {QPointF(left_join, top_y), QPointF(right_join, top_y)}; |
|
|
return {QPointF(left_join, top_y), QPointF(right_join, top_y)}; |
|
|
|