| 285 | } |
| 286 | |
| 287 | void ScrollListContainer::RemoveWidget(QWidget *widget){ |
| 288 | int index; |
| 289 | if(widget == nullptr){ |
| 290 | index = size - 1; |
| 291 | if(index != -1) |
| 292 | widget = widgets[index]; |
| 293 | } |
| 294 | else |
| 295 | index = widgets.indexOf(widget); |
| 296 | if(index == -1 || widget == nullptr){ |
| 297 | return; |
| 298 | } |
| 299 | this->resize(this->width(), this->height() - widget->height() - spacing); |
| 300 | this->parentWidget()->update(); |
| 301 | widget->hide(); |
| 302 | widget->setParent(nullptr); |
| 303 | QParallelAnimationGroup* dpGroup = new QParallelAnimationGroup; |
| 304 | for(int i = index - 1; i >= 0; i--){ |
| 305 | ys[i] -= (widget->height() + spacing); |
| 306 | QPropertyAnimation* move = new QPropertyAnimation(widgets[i], "pos"); |
| 307 | move->setDuration(750); |
| 308 | move->setStartValue(widgets[i]->pos()); |
| 309 | move->setEndValue(QPoint(widgets[i]->x(), ys[i])); |
| 310 | move->setEasingCurve(QEasingCurve::InOutQuart); |
| 311 | dpGroup->addAnimation(move); |
| 312 | } |
| 313 | dpGroup->start(QAbstractAnimation::DeleteWhenStopped); |
| 314 | widgets.remove(index); |
| 315 | size--; |
| 316 | ys.remove(index); |
| 317 | } |
| 318 | |
| 319 | void ScrollListContainer::updateHeight(){ |
| 320 | for(int i = size - 2; i >= 0; i--){ |
no test coverage detected