实现动画效果
1、同一份代码,Qt5.14.2版本出现卡顿现象,难道Qt的新版本可能对操作系统、图形驱动或硬件要求有所变化。Qt 5.14.2可能需要更高的硬件性能或特定的图形加速支持,而Qt 5.7.1版本可能对较老的硬件或驱动兼容性更好。
2、上代码
int x = 0;
int y = 0;
QScreen * screen = QGuiApplication::primaryScreen();
if (screen) {
const QRect desk_rect = screen->availableGeometry();
x = desk_rect.width() - width();
y = desk_rect.height();
}
QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");
animation->setDuration(3000);
animation->setStartValue(QRect(x, y, width(), height()));
animation->setEndValue(QRect(x, y - height(), width(), height()));
animation->start();
求解惑????
在Qt5.14.2版本中,代码实现的动画效果出现卡顿,可能由于新版本对硬件性能和图形驱动有更高要求。与之对比,Qt5.7.1可能在老旧硬件上表现更佳。代码示例展示了使用QPropertyAnimation进行窗口位置的动画操作,动画从屏幕顶部移动到底部。
4527





