Skip to content

Commit

Permalink
[ui] Add tooltip when changing slider value in tile scale panel
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Aug 22, 2018
1 parent b37832a commit 560164d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/providers/wms/qgstilescalewidget.cpp
Expand Up @@ -28,6 +28,7 @@
#include <QMainWindow>
#include <QMenu>
#include <QGraphicsView>
#include <QToolTip>

QgsTileScaleWidget::QgsTileScaleWidget( QgsMapCanvas *mapCanvas, QWidget *parent, Qt::WindowFlags f )
: QWidget( parent, f )
Expand Down Expand Up @@ -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() );
}

Expand Down

0 comments on commit 560164d

Please sign in to comment.