mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-10 00:08:20 -05:00
A horizontal mouse wheel scroll over the canvas "scrubs" the temporal
range slider back or forward
This commit is contained in:
parent
5cbd3e9663
commit
ad56216f14
@ -29,7 +29,7 @@ A widget for controlling playback properties of a :py:class:`QgsTemporalControll
|
|||||||
Constructor for QgsTemporalControllerWidget, with the specified ``parent`` widget.
|
Constructor for QgsTemporalControllerWidget, with the specified ``parent`` widget.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
QgsTemporalController *temporalController();
|
QgsTemporalNavigationObject *temporalController();
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns the temporal controller object used by this object in navigation.
|
Returns the temporal controller object used by this object in navigation.
|
||||||
|
|
||||||
|
|||||||
@ -1226,6 +1226,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
|
|||||||
mTemporalControllerWidget->setToggleVisibilityAction( mActionTemporalController );
|
mTemporalControllerWidget->setToggleVisibilityAction( mActionTemporalController );
|
||||||
|
|
||||||
mMapCanvas->setTemporalController( mTemporalControllerWidget->temporalController() );
|
mMapCanvas->setTemporalController( mTemporalControllerWidget->temporalController() );
|
||||||
|
mTemporalControllerWidget->setMapCanvas( mMapCanvas );
|
||||||
|
|
||||||
QgsGui::instance()->dataItemGuiProviderRegistry()->addProvider( new QgsAppDirectoryItemGuiProvider() );
|
QgsGui::instance()->dataItemGuiProviderRegistry()->addProvider( new QgsAppDirectoryItemGuiProvider() );
|
||||||
QgsGui::instance()->dataItemGuiProviderRegistry()->addProvider( new QgsProjectHomeItemGuiProvider() );
|
QgsGui::instance()->dataItemGuiProviderRegistry()->addProvider( new QgsProjectHomeItemGuiProvider() );
|
||||||
|
|||||||
@ -51,6 +51,28 @@ QgsTemporalController *QgsTemporalControllerDockWidget::temporalController()
|
|||||||
return mControllerWidget->temporalController();
|
return mControllerWidget->temporalController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsTemporalControllerDockWidget::setMapCanvas( QgsMapCanvas *canvas )
|
||||||
|
{
|
||||||
|
if ( canvas && canvas->viewport() )
|
||||||
|
canvas->viewport()->installEventFilter( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QgsTemporalControllerDockWidget::eventFilter( QObject *object, QEvent *event )
|
||||||
|
{
|
||||||
|
if ( event->type() == QEvent::Wheel )
|
||||||
|
{
|
||||||
|
QWheelEvent *wheelEvent = dynamic_cast< QWheelEvent * >( event );
|
||||||
|
// handle horizontal wheel events by scrubbing timeline
|
||||||
|
if ( wheelEvent->angleDelta().x() != 0 )
|
||||||
|
{
|
||||||
|
const int step = -wheelEvent->angleDelta().x() / 120.0;
|
||||||
|
mControllerWidget->temporalController()->setCurrentFrameNumber( mControllerWidget->temporalController()->currentFrameNumber() + step );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QgsDockWidget::eventFilter( object, event );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsTemporalControllerDockWidget::exportAnimation()
|
void QgsTemporalControllerDockWidget::exportAnimation()
|
||||||
{
|
{
|
||||||
QgsAnimationExportDialog *dlg = new QgsAnimationExportDialog( this, QgisApp::instance()->mapCanvas(), QgisApp::instance()->activeDecorations() );
|
QgsAnimationExportDialog *dlg = new QgsAnimationExportDialog( this, QgisApp::instance()->mapCanvas(), QgisApp::instance()->activeDecorations() );
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
class QgsTemporalControllerWidget;
|
class QgsTemporalControllerWidget;
|
||||||
class QgsTemporalController;
|
class QgsTemporalController;
|
||||||
|
class QgsMapCanvas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup app
|
* \ingroup app
|
||||||
@ -47,6 +48,12 @@ class APP_EXPORT QgsTemporalControllerDockWidget : public QgsDockWidget
|
|||||||
*/
|
*/
|
||||||
QgsTemporalController *temporalController();
|
QgsTemporalController *temporalController();
|
||||||
|
|
||||||
|
void setMapCanvas( QgsMapCanvas *canvas );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool eventFilter( QObject *object, QEvent *event ) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void exportAnimation();
|
void exportAnimation();
|
||||||
|
|||||||
@ -480,7 +480,7 @@ void QgsTemporalControllerWidget::updateRangeLabel( const QgsDateTimeRange &rang
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsTemporalController *QgsTemporalControllerWidget::temporalController()
|
QgsTemporalNavigationObject *QgsTemporalControllerWidget::temporalController()
|
||||||
{
|
{
|
||||||
return mNavigationObject;
|
return mNavigationObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class GUI_EXPORT QgsTemporalControllerWidget : public QgsPanelWidget, private Ui
|
|||||||
*
|
*
|
||||||
* The dock widget retains ownership of the returned object.
|
* The dock widget retains ownership of the returned object.
|
||||||
*/
|
*/
|
||||||
QgsTemporalController *temporalController();
|
QgsTemporalNavigationObject *temporalController();
|
||||||
|
|
||||||
#ifndef SIP_RUN
|
#ifndef SIP_RUN
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user