Здесь, в моем коде: < /p>
mainLayout->removeWidget(menuWidget);
mainLayout->insertSpacing(0, 60);
// Create a QPropertyAnimation to animate the width of menuWidget
QPropertyAnimation* resizeAnimation = new QPropertyAnimation(menuWidget, "size");
resizeAnimation->setDuration(20); // Set the duration of the animation
resizeAnimation->setStartValue(menuWidget->size()); // Start from the current width
resizeAnimation->setEndValue(QSize(220, menuWidget->height())); // Animate to the target width
// Start the animation
resizeAnimation->start(QAbstractAnimation::KeepWhenStopped);
menuWidget->raise();
< /code>
Анимация не влияет на размер меню. Mainlayout - это qhboxlayout, который содержит MenuWidget, который является Qwidget. Я не знаю, что я делаю не так, это не показывает никакой ошибки, это просто не работает.
Подробнее здесь: https://stackoverflow.com/questions/795 ... my-qwidget