| 30 | } |
| 31 | |
| 32 | void OverlayMsgProxy::openBase(QString title, |
| 33 | QString desc, |
| 34 | QString icon, |
| 35 | QString close, |
| 36 | QString color) |
| 37 | { |
| 38 | QLabel *lbTitle = new QLabel(title); |
| 39 | QLabel *lbIcon = new QLabel; |
| 40 | QLabel *lbDescription = new QLabel(desc); |
| 41 | QPushButton *lbClose = new QPushButton(close); |
| 42 | QGridLayout *lbLayout = new QGridLayout; |
| 43 | |
| 44 | lbTitle->setStyleSheet("font-size: 24px; font-weight: bold; color: white"); |
| 45 | lbIcon->setPixmap(QPixmap(icon)); |
| 46 | lbDescription->setStyleSheet("color: white"); |
| 47 | lbDescription->setWordWrap(true); |
| 48 | lbClose->setMinimumHeight(30); |
| 49 | |
| 50 | lbLayout->setRowStretch(0, 1); |
| 51 | lbLayout->setColumnStretch(0, 1); |
| 52 | lbLayout->addWidget(lbTitle, 1, 1); |
| 53 | lbLayout->addWidget(lbTitle, 1, 1); |
| 54 | lbLayout->addWidget(lbIcon, 1, 2, Qt::AlignRight); |
| 55 | lbLayout->setColumnStretch(3, 1); |
| 56 | lbLayout->addWidget(lbDescription, 2, 1, 1, 2); |
| 57 | lbLayout->addWidget(lbClose, 3, 2); |
| 58 | lbLayout->setRowStretch(4, 1); |
| 59 | |
| 60 | QFile f(":/styles/overlay.qss"); |
| 61 | QTextStream ts(&f); |
| 62 | |
| 63 | f.open(QFile::ReadOnly | QFile::Text); |
| 64 | lbClose->setStyleSheet(ts.readAll().replace("#e67e22", color)); |
| 65 | |
| 66 | QGraphicsOpacityEffect *eff = new QGraphicsOpacityEffect(); |
| 67 | QPropertyAnimation *a = new QPropertyAnimation(eff, "opacity"); |
| 68 | |
| 69 | lightBox->setGraphicsEffect(eff); |
| 70 | lightBox->show(); |
| 71 | a->setDuration(500); |
| 72 | a->setStartValue(0); |
| 73 | a->setEndValue(1); |
| 74 | a->setEasingCurve(QEasingCurve::InBack); |
| 75 | a->start(QPropertyAnimation::DeleteWhenStopped); |
| 76 | |
| 77 | connect(lbClose, &QPushButton::clicked, this, &OverlayMsgProxy::buttonPressed); |
| 78 | connect(lbClose, &QPushButton::clicked, lightBox, [lbClose, this]() { |
| 79 | lbClose->setEnabled(false); |
| 80 | QGraphicsOpacityEffect *eff2 = new QGraphicsOpacityEffect(); |
| 81 | lightBox->setGraphicsEffect(eff2); |
| 82 | QPropertyAnimation *a = new QPropertyAnimation(eff2, "opacity"); |
| 83 | a->setDuration(500); |
| 84 | a->setStartValue(1); |
| 85 | a->setEndValue(0); |
| 86 | a->setEasingCurve(QEasingCurve::OutBack); |
| 87 | a->start(QPropertyAnimation::DeleteWhenStopped); |
| 88 | connect(a, &QAbstractAnimation::finished, [this]() { |
| 89 | lightBox->hide(); |
nothing calls this directly
no test coverage detected