void SCgAlphabet::paintNode(QPainter *painter, const QColor &color, const QRectF &boundRect, const SCgConstType &type, const SCgNodeStructType &type_struct) { QColor brush_color = QColor(255, 255, 255, 224); // to draw not defined nodes we just need to scale them if (type_struct == StructType_NotDefine) { painter->scale(0.3f, 0.3f); brush_color = color; brush_color.setAlpha(224); } // drawing of border QPen pen = QPen(QBrush(color, Qt::SolidPattern), 4, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); QBrush brush = QBrush(brush_color, Qt::SolidPattern); painter->setPen(pen); painter->setBrush(brush); QRectF bound = boundRect.adjusted(2, 2, -2, -2); if (type_struct == StructType_NotDefine) { painter->drawEllipse(bound); return; } if (type == Const) { painter->drawEllipse(bound); QPainterPath clipPath; clipPath.addEllipse(bound.adjusted(1,1,-1,-1)); painter->setClipPath(clipPath, Qt::IntersectClip); paintStruct(painter, color, bound, type_struct); }else { if (type == Var) { painter->scale(0.9f, 0.9f); painter->drawRect(bound); QPainterPath clipPath; clipPath.addRect(bound); painter->setClipPath(clipPath, Qt::IntersectClip); paintStruct(painter, color, bound, type_struct); } } }
virtual Rect GetInvalidRect() const { return Rect(paintStruct().rcPaint); }