Skip to content
Permalink
Browse files

Add temporalExtentsChanged signal to QgsTemporalNavigationObject

  • Loading branch information
rduivenvoorde committed Sep 4, 2020
1 parent 81cf4ee commit f27027fad4856d03e641bd8c265193b3fbec0d72
@@ -148,6 +148,8 @@ void QgsTemporalNavigationObject::setTemporalExtents( const QgsDateTimeRange &te
case NavigationOff:
break;
}

emit temporalExtentsChanged( mTemporalExtents );
}

QgsDateTimeRange QgsTemporalNavigationObject::temporalExtents() const
@@ -217,6 +217,11 @@ class CORE_EXPORT QgsTemporalNavigationObject : public QgsTemporalController, pu
*/
void navigationModeChanged( NavigationMode mode );

/**
* Emitted whenever the temporalExtent \a extent changes.
*/
void temporalExtentsChanged( QgsDateTimeRange extent );

public slots:

/**
@@ -52,6 +52,7 @@ QgsTemporalControllerWidget::QgsTemporalControllerWidget( QWidget *parent )

setWidgetStateFromNavigationMode( mNavigationObject->navigationMode() );
connect( mNavigationObject, &QgsTemporalNavigationObject::navigationModeChanged, this, &QgsTemporalControllerWidget::setWidgetStateFromNavigationMode );
connect( mNavigationObject, &QgsTemporalNavigationObject::temporalExtentsChanged, this, &QgsTemporalControllerWidget::setDates );
connect( mNavigationOff, &QPushButton::clicked, this, &QgsTemporalControllerWidget::mNavigationOff_clicked );
connect( mNavigationFixedRange, &QPushButton::clicked, this, &QgsTemporalControllerWidget::mNavigationFixedRange_clicked );
connect( mNavigationAnimated, &QPushButton::clicked, this, &QgsTemporalControllerWidget::mNavigationAnimated_clicked );
@@ -574,7 +575,12 @@ void QgsTemporalControllerWidget::setDates( const QgsDateTimeRange &range )
whileBlocking( mEndDateTime )->setDateTime( range.end() );
whileBlocking( mFixedRangeStartDateTime )->setDateTime( range.begin() );
whileBlocking( mFixedRangeEndDateTime )->setDateTime( range.end() );
updateTemporalExtent();
// only if range is different from mNavigationObject->temporalExtents update
// else recursion as updateTemporalExtent itself calls mNavigationObject->setTemporalExtents
if ( !(range == mNavigationObject->temporalExtents()) )
{
updateTemporalExtent();
}
}
}

0 comments on commit f27027f

Please sign in to comment.
You can’t perform that action at this time.