MCPcopy Create free account
hub / github.com/Linloir/GraphBuilder / visit

Method visit

graph_view.cpp:485–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485void MyGraphicsVexItem::visit(bool visited){
486 if(visited){
487 QTimeLine *visitEffect = new QTimeLine;
488 visitEffect->setDuration(1000);
489 visitEffect->setFrameRange(0, 200);
490 QEasingCurve curveIn = QEasingCurve::InElastic;
491 QEasingCurve curveOut = QEasingCurve::OutBounce;
492 connect(visitEffect, &QTimeLine::frameChanged, this, [=](int frame){
493 if(frame > 100){
494 this->setBrush(visitedBrush);
495 if(tag)
496 tag->setBrush(visitedBrush);
497 }
498 if(frame < 100){
499 qreal curProgress = curveIn.valueForProgress(frame / 100.0);
500 qreal curRadius = radius + 0.3 * radius * curProgress;
501 this->setRect(QRectF(center.x() - curRadius, center.y() - curRadius, curRadius * 2, curRadius * 2));
502 }
503 else{
504 qreal curProgress = curveOut.valueForProgress((frame - 100.0) / 100.0);
505 qreal curRadius = 1.3 * radius - 0.3 * radius * curProgress;
506 this->setRect(QRectF(center.x() - curRadius, center.y() - curRadius, curRadius * 2, curRadius * 2));
507 }
508 });
509 connect(visitEffect, &QTimeLine::stateChanged, this, [=](){
510 if(visitEffect->state() == QTimeLine::Running){
511 itemShow();
512 this->state |= ON_VISIT;
513 emit logAdded(new viewLog("[Vex] | \""+nameText+"\" set visited"));
514 }
515 });
516 emit addAnimation(visitEffect);
517 }
518 else{
519 state &= ~ON_VISIT;
520 if(state & ON_SELECTED){
521 this->setBrush(selBrush);
522 if(tag)
523 tag->setBrush(selBrush);
524 }
525 else{
526 this->setBrush(regBrush);
527 if(tag)
528 tag->setBrush(regBrush);
529 }
530 }
531}
532
533void MyGraphicsVexItem::itemHide(){
534 nameTag->setBrush(QColor(0, 0, 0, 0));

Callers

nothing calls this directly

Calls 1

TextMethod · 0.80

Tested by

no test coverage detected