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

Method access

graph_view.cpp:565–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563}
564
565void MyGraphicsVexItem::access(const QString &hint, bool isAccess){
566 if(isAccess){
567 if(!tag)
568 tag = new QGraphicsSimpleTextItem;
569 tag->setPos(center + QPointF(radius, radius));
570 tag->setFont(hintFont);
571 tag->setZValue(this->zValue());
572 QTimeLine *accessEffect = new QTimeLine;
573 accessEffect->setDuration(1000);
574 accessEffect->setFrameRange(0, 200);
575 QEasingCurve curveIn = QEasingCurve::InElastic;
576 QEasingCurve curveOut = QEasingCurve::OutBounce;
577 connect(accessEffect, &QTimeLine::frameChanged, this, [=](int frame){
578 if(frame > 100){
579 this->setBrush(accessBrush);
580 this->tag->setBrush(accessBrush);
581 this->scene()->addItem(tag);
582 tag->setText(hint);
583 this->hintText = hint;
584 }
585 if(frame < 100){
586 qreal curProgress = curveIn.valueForProgress(frame / 100.0);
587 qreal curRadius = radius + 0.3 * radius * curProgress;
588 this->setRect(QRectF(center.x() - curRadius, center.y() - curRadius, curRadius * 2, curRadius * 2));
589 this->tag->setScale(1 + curProgress * 0.2);
590 }
591 else{
592 qreal curProgress = curveOut.valueForProgress((frame - 100.0) / 100.0);
593 qreal curRadius = 1.3 * radius - 0.3 * radius * curProgress;
594 this->setRect(QRectF(center.x() - curRadius, center.y() - curRadius, curRadius * 2, curRadius * 2));
595 this->tag->setScale(1.2 - curProgress * 0.2);
596 }
597 });
598 connect(accessEffect, &QTimeLine::stateChanged, this, [=](){
599 if(accessEffect->state() == QTimeLine::Running){
600 itemShow();
601 emit logAdded(new viewLog("[Vex] | \""+nameText+"\" accessed with hint "+hint));
602 }
603 });
604 emit addAnimation(accessEffect);
605 }
606 else{
607 hintText = "";
608 if(tag)
609 scene()->removeItem(tag);
610 tag = nullptr;
611 }
612}
613
614void MyGraphicsVexItem::remove(){
615 int s = linesStartWith.size();

Callers

nothing calls this directly

Calls 3

setScaleMethod · 0.80
TextMethod · 0.80
setTextMethod · 0.45

Tested by

no test coverage detected