QPropertyAnimation *animation = new QPropertyAnimation(progressBar, "value"); animation->setDuration(2000); // 2 seconds animation->setStartValue(0); animation->setEndValue(100); animation->setKeyValueAt(0.5, 50); // key value at 50% of the animation animation->start();
QPropertyAnimation *animation = new QPropertyAnimation(label, "text"); animation->setDuration(2000); // 2 seconds animation->setStartValue("0"); animation->setEndValue("100"); animation->setKeyValueAt(0.2, "20"); // key value at 20% of the animation animation->setKeyValueAt(0.8, "80"); // key value at 80% of the animation animation->start();Package library: Qt.