20 virtual void paint(QPainter* painter, QtNodes::NodeGeometry
const& geom, QtNodes::NodeDataModel
const* model,
21 QtNodes::NodeGraphicsObject
const& graphicsObject)
override
23 QtNodes::NodeStyle
const& nodeStyle = model->nodeStyle();
25 auto color = nodeStyle.NormalBoundaryColor;
27 QPen p(color, nodeStyle.PenWidth);
28 painter->setPen(Qt::NoPen);
29 painter->setBrush(QBrush(_headerColor));
31 float diam = nodeStyle.ConnectionPointDiameter;
37 boundary = QRectF(-diam + 1, -diam + 1, 2.0 * diam + geom.width() - 2, 21);
38 boundary2 = QRectF(-diam + 1, -diam + 11, 2.0 * diam + geom.width() - 2, 12);
40 }
else if (graphicsObject.isSelected()) {
41 boundary = QRectF(-diam + 0.75, -diam + 0.75, 2.0 * diam + geom.width() - 1.5, 21.25);
42 boundary2 = QRectF(-diam + 0.75, -diam + 11, 2.0 * diam + geom.width() - 1.5, 12);
45 boundary = QRectF(-diam - 0.75, -diam - 0.75, 2.0 * diam + geom.width() + 1.5, 22.75);
46 boundary2 = QRectF(-diam - 0.75, -diam + 11, 2.0 * diam + geom.width() + 1.5, 12);
50 painter->drawRoundedRect(boundary, radius, radius);
51 painter->drawRect(boundary2);
53 painter->setPen({ Qt::white, 1 });
54 QFont font({
"Arial", 10 });
56 painter->setFont(font);
57 painter->drawText(-diam + 6, -diam + 16, model->caption());