Skip to content
Permalink
Browse files

When clicking the "time range from project" button in the temporal dock,

if NO explicit time range is set for a project then automatically calculate
the range from the map's layers
  • Loading branch information
nyalldawson committed Mar 13, 2020
1 parent ade535b commit 3b6c4db5cdeac32826b963b3e141a9da81074e13
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/gui/qgstemporalcontrollerwidget.cpp
@@ -21,6 +21,7 @@
#include "qgsprojecttimesettings.h"
#include "qgstemporalnavigationobject.h"
#include "qgstemporalmapsettingswidget.h"
#include "qgstemporalutils.h"

QgsTemporalControllerWidget::QgsTemporalControllerWidget( QWidget *parent )
: QgsPanelWidget( parent )
@@ -187,9 +188,17 @@ void QgsTemporalControllerWidget::timeSlider_valueChanged( int value )
void QgsTemporalControllerWidget::setDatesToProjectTime()
{
QgsDateTimeRange range;

// by default try taking the project's fixed temporal extent
if ( QgsProject::instance()->timeSettings() )
range = QgsProject::instance()->timeSettings()->temporalRange();

// if that's not set, calculate the extent from the project's layers
if ( !range.begin().isValid() || !range.end().isValid() )
{
range = QgsTemporalUtils::calculateTemporalRangeForProject( QgsProject::instance() );
}

if ( range.begin().isValid() && range.end().isValid() )
{
mStartDateTime->setDateTime( range.begin() );

0 comments on commit 3b6c4db

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