Skip to content
Permalink
Browse files

Make temporal dock settings open as an inline panel

Allows for interactive change of frame rate while seeing results immediately,
avoids a blocking modal dialog
  • Loading branch information
nyalldawson committed Mar 12, 2020
1 parent 97cc157 commit ea78314e03a906007b7d1f8f693bb2071dc33535
@@ -24,6 +24,7 @@ QgsTemporalControllerDockWidget::QgsTemporalControllerDockWidget( const QString
{
setWindowTitle( name );
mControllerWidget = new QgsTemporalControllerWidget();
mControllerWidget->setDockMode( true );

QgsPanelWidgetStack *stack = new QgsPanelWidgetStack();
stack->setMainPanel( mControllerWidget );
@@ -167,16 +167,16 @@ QgsTemporalController *QgsTemporalControllerWidget::temporalController()

void QgsTemporalControllerWidget::settings_clicked()
{
QgsTemporalMapSettingsDialog dialog( this );
dialog.mapSettingsWidget()->setFrameRateValue( mNavigationObject->framesPerSecond() );
QgsTemporalMapSettingsWidget *settingsWidget = new QgsTemporalMapSettingsWidget( this );
settingsWidget->setFrameRateValue( mNavigationObject->framesPerSecond() );

if ( dialog.exec() )
connect( settingsWidget, &QgsTemporalMapSettingsWidget::frameRateChanged, this, [ = ]( double rate )
{
// save new settings into project
QgsProject::instance()->timeSettings()->setFramesPerSecond( dialog.mapSettingsWidget()->frameRateValue() );

mNavigationObject->setFramesPerSecond( QgsProject::instance()->timeSettings()->framesPerSecond() );
}
QgsProject::instance()->timeSettings()->setFramesPerSecond( rate );
mNavigationObject->setFramesPerSecond( rate );
} );
openPanel( settingsWidget );
}

void QgsTemporalControllerWidget::timeSlider_valueChanged( int value )
@@ -26,7 +26,7 @@ QgsTemporalMapSettingsWidget::QgsTemporalMapSettingsWidget( QWidget *parent )
setupUi( this );
setPanelTitle( tr( "Temporal Settings" ) );

connect( mFrameSpinBox, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsTemporalMapSettingsWidget::frameRateChange );
connect( mFrameSpinBox, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsTemporalMapSettingsWidget::frameRateChanged );
}

double QgsTemporalMapSettingsWidget::frameRateValue()
@@ -39,9 +39,4 @@ void QgsTemporalMapSettingsWidget::setFrameRateValue( double value )
mFrameSpinBox->setValue( value );
}

void QgsTemporalMapSettingsWidget::frameRateChange()
{
emit frameRateChanged();
}

///@endcond
@@ -50,18 +50,9 @@ class GUI_EXPORT QgsTemporalMapSettingsWidget : public QgsPanelWidget, private U
signals:

/**
* Emitted when frame rate value on the spin box has changed.
* Emitted when frame \a rate value on the spin box has changed.
*/
void frameRateChanged();

private slots:

/**
* Emits frame rate change signal.
*
* \see frameRateChanged()
*/
void frameRateChange();
void frameRateChanged( double rate );


};

0 comments on commit ea78314

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