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

Method paint

Gui/Edge.cpp:767–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765}
766
767void
768Edge::paint(QPainter *painter,
769 const QStyleOptionGraphicsItem * /*options*/,
770 QWidget * /*parent*/)
771{
772 bool antialias = appPTR->getCurrentSettings()->isNodeGraphAntiAliasingEnabled();
773
774 if (!antialias) {
775 painter->setRenderHint(QPainter::Antialiasing, false);
776 }
777
778 QPen myPen = pen();
779 NodeGuiPtr dst = _imp->dest.lock();
780 if (dst) {
781 if ( dst->getDagGui()->isDoingNavigatorRender() ) {
782 return;
783 }
784 }
785
786 if (_imp->paintWithDash) {
787 QVector<qreal> dashStyle;
788 qreal space = 4;
789 dashStyle << 3 << space;
790 myPen.setDashPattern(dashStyle);
791 } else {
792 myPen.setStyle(Qt::SolidLine);
793 }
794
795 QColor color, arrowColor;
796 if (_imp->useSelected) {
797 color = arrowColor = Qt::white;
798 } else if (_imp->useHighlight) {
799 color = arrowColor = Qt::green;
800 } else if (_imp->useRenderingColor) {
801 color = arrowColor = _imp->renderingColor;
802 } else {
803 color = arrowColor = _imp->defaultColor;
804 if (_imp->optional && !_imp->paintWithDash) {
805 color.setAlphaF(0.4);
806 }
807 }
808 myPen.setColor(color);
809 painter->setPen(myPen);
810
811
812 painter->drawLine( line() );
813
814 myPen.setStyle(Qt::SolidLine);
815 painter->setPen(myPen);
816
817 QPainterPath headPath;
818 headPath.addPolygon(_imp->arrowHead);
819 headPath.closeSubpath();
820 myPen.setColor(arrowColor);
821 myPen.setJoinStyle(Qt::MiterJoin);
822 painter->fillPath(headPath, color);
823 painter->strokePath(headPath, myPen); // also draw the outline, or arrows are too small
824

Callers

nothing calls this directly

Calls 9

getCurrentSettingsMethod · 0.80
getDagGuiMethod · 0.80
setWidthMethod · 0.80
lockMethod · 0.45
setColorMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected