Skip to content

Commit

Permalink
Add temporalExtentsChanged signal to QgsTemporalNavigationObject
Browse files Browse the repository at this point in the history
  • Loading branch information
rduivenvoorde committed Sep 4, 2020
1 parent 81cf4ee commit f27027f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/core/qgstemporalnavigationobject.cpp
Expand Up @@ -148,6 +148,8 @@ void QgsTemporalNavigationObject::setTemporalExtents( const QgsDateTimeRange &te
case NavigationOff:
break;
}

emit temporalExtentsChanged( mTemporalExtents );
}

QgsDateTimeRange QgsTemporalNavigationObject::temporalExtents() const
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgstemporalnavigationobject.h
Expand Up @@ -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:

/**
Expand Down
8 changes: 7 additions & 1 deletion src/gui/qgstemporalcontrollerwidget.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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();
}
}
}

Expand Down

0 comments on commit f27027f

Please sign in to comment.