MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / paint

Method paint

Gui/NodeGraphTextItem.cpp:65–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void
66NodeGraphTextItem::paint(QPainter *painter,
67 const QStyleOptionGraphicsItem *option,
68 QWidget *widget)
69{
70 bool isTooSmall = false;
71
72 if (!_alwaysDrawText) {
73 if ( _graph->isDoingNavigatorRender() ) {
74 isTooSmall = true;
75 } else {
76 QFontMetrics fm( font() );
77 QPoint topLeft = _graph->mapFromScene( mapToScene( QPointF(0, 0) ) );
78 QPoint btmLeft = _graph->mapFromScene( mapToScene( QPointF( 0, fm.height() ) ) );
79 int height = std::abs( btmLeft.y() - topLeft.y() );
80 isTooSmall = height < NODEGRAPH_TEXT_ITEM_MIN_HEIGHT_PX;
81 }
82 }
83 if (isTooSmall) {
84 return;
85 }
86 QGraphicsTextItem::paint(painter, option, widget);
87}
88
89NodeGraphSimpleTextItem::NodeGraphSimpleTextItem(NodeGraph* graph,
90 QGraphicsItem* parent,

Callers

nothing calls this directly

Calls 7

fontFunction · 0.85
QPointFClass · 0.70
absFunction · 0.50
heightMethod · 0.45
yMethod · 0.45
boundingRectMethod · 0.45

Tested by

no test coverage detected