Qt学习记录-窗口动画
窗口动画主要用到QPropertyAnimation类。
//获取控件位置
QPoint point(ui.treeWidget->pos());
int px = point.x();
int py = point.y();
//创建窗口进入特效
QPropertyAnimation* animation = new QPropertyAnimation(ui.treeWidget, "pos");
//设置窗口进入的起始位置
animation->setDuration(500);
animation->setStartValue(QPoint(0, py));
animation->setEndValue(QPoint(px, py));
//选择特效
//animation->setEasingCurve(QEasingCurve::OutBounce);
//开始播放特效
animation->start();