Skip to content
Permalink
Browse files

[ui] Add tooltip when changing slider value in tile scale panel

  • Loading branch information
nirvn committed Aug 22, 2018
1 parent b37832a commit 560164debe0dc2589d2731094c43cd7b8bc7396c
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/providers/wms/qgstilescalewidget.cpp
@@ -28,6 +28,7 @@
#include <QMainWindow>
#include <QMenu>
#include <QGraphicsView>
#include <QToolTip>

QgsTileScaleWidget::QgsTileScaleWidget( QgsMapCanvas *mapCanvas, QWidget *parent, Qt::WindowFlags f )
: QWidget( parent, f )
@@ -102,8 +103,10 @@ void QgsTileScaleWidget::scaleChanged( double scale )

void QgsTileScaleWidget::mSlider_valueChanged( int value )
{
Q_UNUSED( value );
QgsDebugMsg( QString( "slider released at %1: %2" ).arg( mSlider->value() ).arg( mResolutions.at( mSlider->value() ) ) );

// Invert value in tooltip to match expectation (i.e. 0 = zoomed out, maximum = zoomed in)
QToolTip::showText( QCursor::pos(), QString( "Zoom level: %1\nResolution: %2" ).arg( mSlider->maximum() - value ).arg( mResolutions.at( value ) ), this );
mMapCanvas->zoomByFactor( mResolutions.at( mSlider->value() ) / mMapCanvas->mapUnitsPerPixel() );
}

0 comments on commit 560164d

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