| 652 | } |
| 653 | |
| 654 | void textInputItem::leaveEditEffect(){ |
| 655 | editor->setCursorPosition(0); |
| 656 | editor->setStyleSheet("color:#5c5c5c;background-color:#00000000;border-style:none;"); |
| 657 | QParallelAnimationGroup *group = new QParallelAnimationGroup(this); |
| 658 | QPropertyAnimation *shorter = new QPropertyAnimation(indicator, "geometry", this); |
| 659 | shorter->setStartValue(indicator->geometry()); |
| 660 | shorter->setEndValue(QRectF(this->width() - margin - 4, this->height() - 7, 4, 4)); |
| 661 | shorter->setDuration(500); |
| 662 | shorter->setEasingCurve(QEasingCurve::InOutExpo); |
| 663 | QPropertyAnimation *fade = new QPropertyAnimation(opac, "opacity", this); |
| 664 | fade->setStartValue(opac->opacity()); |
| 665 | fade->setEndValue(0); |
| 666 | fade->setDuration(350); |
| 667 | QPropertyAnimation *move = new QPropertyAnimation(editor, "geometry", this); |
| 668 | move->setStartValue(editor->geometry()); |
| 669 | int width = QFontMetrics(editor->font()).size(Qt::TextSingleLine, editor->text()).width() + 3; |
| 670 | if(width > this->width() * 0.7 - margin) |
| 671 | move->setEndValue(QRectF(this->width() * 0.3, this->height() / 2 - editor->height() / 2, this->width() * 0.7 - margin, editor->height())); |
| 672 | else |
| 673 | move->setEndValue(QRectF(this->width() - width - margin, this->height() / 2 - editor->height() / 2, width, editor->height())); |
| 674 | move->setDuration(500); |
| 675 | move->setEasingCurve(QEasingCurve::InOutExpo); |
| 676 | group->addAnimation(shorter); |
| 677 | group->addAnimation(fade); |
| 678 | group->addAnimation(move); |
| 679 | group->start(); |
| 680 | } |
| 681 | |
| 682 | void textInputItem::enterEvent(QEnterEvent *event){ |
| 683 | bgWidget->setStyleSheet("border-radius:5px;background-color:#0a000000"); |
nothing calls this directly
no test coverage detected