Skip to content

Commit

Permalink
Add temporalFrameDurationChanged signal, and make view more aware of …
Browse files Browse the repository at this point in the history
…changes

This commit adds a new signal to the QgsTemporalNavigationObject, which is
emitted when the frameDuration (of current QgsTemporalNavigationObject) is
change.

It also fixes the issue that changing the frame in the Temporal
Navigation-WIDGET was not reflected in the widget itself.
  • Loading branch information
rduivenvoorde authored and nyalldawson committed Oct 22, 2020
1 parent ff1d21a commit a59de06
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/core/auto_generated/qgstemporalnavigationobject.sip.in
Expand Up @@ -208,6 +208,12 @@ Emitted whenever the navigation ``mode`` changes.
Emitted whenever the temporalExtent ``extent`` changes.
%End

void temporalFrameDurationChanged( const QgsInterval &interval );
%Docstring
Emitted whenever the frameDuration ``interval`` of the controller changes.
%End


public slots:

void play();
Expand Down
8 changes: 8 additions & 0 deletions src/core/qgstemporalnavigationobject.cpp
Expand Up @@ -178,8 +178,16 @@ long long QgsTemporalNavigationObject::currentFrameNumber() const

void QgsTemporalNavigationObject::setFrameDuration( QgsInterval frameDuration )
{
if ( mFrameDuration == frameDuration )
{
return;
}
mFrameDuration = frameDuration;
emit temporalFrameDurationChanged( mFrameDuration );
setCurrentFrameNumber( 0 );
// forcing an update of our views
QgsDateTimeRange range = dateTimeRangeForFrameNumber( mCurrentFrameNumber );
emit updateTemporalRange( range );
}

QgsInterval QgsTemporalNavigationObject::frameDuration() const
Expand Down
6 changes: 6 additions & 0 deletions src/core/qgstemporalnavigationobject.h
Expand Up @@ -222,6 +222,12 @@ class CORE_EXPORT QgsTemporalNavigationObject : public QgsTemporalController, pu
*/
void temporalExtentsChanged( const QgsDateTimeRange &extent );

/**
* Emitted whenever the frameDuration \a interval of the controller changes.
*/
void temporalFrameDurationChanged( const QgsInterval &interval );


public slots:

/**
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgstemporalcontrollerwidget.cpp
Expand Up @@ -53,6 +53,7 @@ QgsTemporalControllerWidget::QgsTemporalControllerWidget( QWidget *parent )
setWidgetStateFromNavigationMode( mNavigationObject->navigationMode() );
connect( mNavigationObject, &QgsTemporalNavigationObject::navigationModeChanged, this, &QgsTemporalControllerWidget::setWidgetStateFromNavigationMode );
connect( mNavigationObject, &QgsTemporalNavigationObject::temporalExtentsChanged, this, &QgsTemporalControllerWidget::setDates );
connect( mNavigationObject, &QgsTemporalNavigationObject::temporalFrameDurationChanged, this, &QgsTemporalControllerWidget::setTimeStep );
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

0 comments on commit a59de06

Please sign in to comment.