@@ -33,6 +33,7 @@ Qgs3DAnimationWidget::Qgs3DAnimationWidget( QWidget *parent )
33
33
btnEditKeyframe->setIcon ( QIcon ( QgsApplication::iconPath ( " symbologyEdit.svg" ) ) );
34
34
btnPlayPause->setIcon ( QIcon ( QgsApplication::iconPath ( " mTaskRunning.svg" ) ) );
35
35
btnDuplicateKeyframe->setIcon ( QIcon ( QgsApplication::iconPath ( " mActionEditCopy.svg" ) ) );
36
+ btnRepeat->setIcon ( QIcon ( QgsApplication::iconPath ( " mActionRefresh.svg" ) ) );
36
37
37
38
cboKeyframe->addItem ( tr ( " <none>" ) );
38
39
@@ -48,6 +49,8 @@ Qgs3DAnimationWidget::Qgs3DAnimationWidget( QWidget *parent )
48
49
btnPlayPause->setCheckable ( true );
49
50
connect ( btnPlayPause, &QToolButton::clicked, this , &Qgs3DAnimationWidget::onPlayPause );
50
51
52
+ btnRepeat->setCheckable ( true );
53
+
51
54
connect ( sliderTime, &QSlider::valueChanged, this , &Qgs3DAnimationWidget::onSliderValueChanged );
52
55
53
56
connect ( cboKeyframe, qgis::overload<int >::of ( &QComboBox::currentIndexChanged ), this , &Qgs3DAnimationWidget::onKeyframeChanged );
@@ -139,8 +142,21 @@ void Qgs3DAnimationWidget::onPlayPause()
139
142
140
143
void Qgs3DAnimationWidget::onAnimationTimer ()
141
144
{
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
+ }
144
160
}
145
161
146
162
@@ -173,7 +189,12 @@ void Qgs3DAnimationWidget::onCameraChanged()
173
189
174
190
void Qgs3DAnimationWidget::onKeyframeChanged ()
175
191
{
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 )
177
198
return ;
178
199
179
200
// jump to the camera view of the keyframe
0 commit comments