Skip to content
Permalink
Browse files

Properly set stacked widget index when loading and clearing projects

  • Loading branch information
nirvn committed May 15, 2020
1 parent dc81474 commit d10b2e891308ed2bfd87952dc5f1afe31e7fed83
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/gui/qgstemporalcontrollerwidget.cpp
@@ -167,7 +167,15 @@ void QgsTemporalControllerWidget::setWidgetStateFromProject()
QgsTemporalNavigationObject::NavigationMode mode = static_cast< QgsTemporalNavigationObject::NavigationMode>( QgsProject::instance()->readNumEntry( QStringLiteral( "TemporalControllerWidget" ),
QStringLiteral( "/NavigationMode" ), 0, &ok ) );
if ( ok )
{
mNavigationObject->setNavigationMode( mode );
setWidgetStateFromNavigationMode( mode );
}
else
{
mNavigationObject->setNavigationMode( QgsTemporalNavigationObject::NavigationOff );
setWidgetStateFromNavigationMode( QgsTemporalNavigationObject::NavigationOff );
}

const QString startString = QgsProject::instance()->readEntry( QStringLiteral( "TemporalControllerWidget" ), QStringLiteral( "/StartDateTime" ) );
const QString endString = QgsProject::instance()->readEntry( QStringLiteral( "TemporalControllerWidget" ), QStringLiteral( "/EndDateTime" ) );
@@ -269,6 +277,10 @@ void QgsTemporalControllerWidget::onLayersAdded( const QList<QgsMapLayer *> &lay
void QgsTemporalControllerWidget::onProjectCleared()
{
mHasTemporalLayersLoaded = false;

mNavigationObject->setNavigationMode( QgsTemporalNavigationObject::NavigationOff );
setWidgetStateFromNavigationMode( QgsTemporalNavigationObject::NavigationOff );

whileBlocking( mStartDateTime )->setDateTime( QDateTime( QDate::currentDate(), QTime( 0, 0, 0, Qt::UTC ) ) );
whileBlocking( mEndDateTime )->setDateTime( mStartDateTime->dateTime() );
whileBlocking( mFixedRangeStartDateTime )->setDateTime( QDateTime( QDate::currentDate(), QTime( 0, 0, 0, Qt::UTC ) ) );

0 comments on commit d10b2e8

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