14 virtual void paint(QPainter* painter, QtNodes::NodeGeometry
const& geom, QtNodes::NodeDataModel
const* model,
15 QtNodes::NodeGraphicsObject
const& graphicsObject)
override
19 QtNodes::NodeStyle
const& nodeStyle = model->nodeStyle();
22 painter->setPen(QPen(nodeStyle.FontColorFaded, 2));
23 painter->setBrush(Qt::NoBrush);
25 QFont font({
"Arial", 8 });
27 painter->setFont(font);
28 QString val = QString::number(_load) +
"%";
29 QFontMetrics metrics(font);
30 auto rect = metrics.boundingRect(val);
32 QPoint p(geom.width() / 2, geom.height() / 2 + 12);
33 painter->drawEllipse(p, s, s);
35 painter->setPen(nodeStyle.FontColor);
36 QPoint t(p.x() - rect.width() / 2 + 1, p.y() + 4);
37 painter->drawText(t, val);