@@ -33,6 +33,7 @@ Qgs3DAnimationWidget::Qgs3DAnimationWidget( QWidget *parent )
3333 btnEditKeyframe->setIcon ( QIcon ( QgsApplication::iconPath ( " symbologyEdit.svg" ) ) );
3434 btnPlayPause->setIcon ( QIcon ( QgsApplication::iconPath ( " mTaskRunning.svg" ) ) );
3535 btnDuplicateKeyframe->setIcon ( QIcon ( QgsApplication::iconPath ( " mActionEditCopy.svg" ) ) );
36+ btnRepeat->setIcon ( QIcon ( QgsApplication::iconPath ( " mActionRefresh.svg" ) ) );
3637
3738 cboKeyframe->addItem ( tr ( " <none>" ) );
3839
@@ -48,6 +49,8 @@ Qgs3DAnimationWidget::Qgs3DAnimationWidget( QWidget *parent )
4849 btnPlayPause->setCheckable ( true );
4950 connect ( btnPlayPause, &QToolButton::clicked, this , &Qgs3DAnimationWidget::onPlayPause );
5051
52+ btnRepeat->setCheckable ( true );
53+
5154 connect ( sliderTime, &QSlider::valueChanged, this , &Qgs3DAnimationWidget::onSliderValueChanged );
5255
5356 connect ( cboKeyframe, qgis::overload<int >::of ( &QComboBox::currentIndexChanged ), this , &Qgs3DAnimationWidget::onKeyframeChanged );
@@ -139,8 +142,21 @@ void Qgs3DAnimationWidget::onPlayPause()
139142
140143void Qgs3DAnimationWidget::onAnimationTimer ()
141144{
142- float duration = sliderTime->maximum ();
143- sliderTime->setValue ( sliderTime->value () >= duration ? 0 : sliderTime->value () + 1 );
145+ if ( sliderTime->value () >= sliderTime->maximum () )
146+ {
147+ if ( btnRepeat->isChecked () )
148+ sliderTime->setValue ( 0 );
149+ else
150+ {
151+ // stop playback
152+ onPlayPause ();
153+ btnPlayPause->setChecked ( false );
154+ }
155+ }
156+ else
157+ {
158+ sliderTime->setValue ( sliderTime->value () + 1 );
159+ }
144160}
145161
146162
@@ -173,7 +189,12 @@ void Qgs3DAnimationWidget::onCameraChanged()
173189
174190void Qgs3DAnimationWidget::onKeyframeChanged ()
175191{
176- if ( cboKeyframe->currentIndex () <= 0 )
192+ bool hasKeyframe = cboKeyframe->currentIndex () > 0 ;
193+ btnRemoveKeyframe->setEnabled ( hasKeyframe );
194+ btnEditKeyframe->setEnabled ( hasKeyframe );
195+ btnDuplicateKeyframe->setEnabled ( hasKeyframe );
196+
197+ if ( !hasKeyframe )
177198 return ;
178199
179200 // jump to the camera view of the keyframe
0 commit comments