Skip to content
Permalink
Browse files

Minor clean ups

  • Loading branch information
nyalldawson committed May 29, 2016
1 parent 421ab4f commit 497d6ef4134413e025f6b2514187c5a99f4eeb4e
@@ -23,24 +23,24 @@
#include "qgsstatusbarmagnifierwidget.h"
#include "qgsdoublespinbox.h"

QgsStatusBarMagnifierWidget::QgsStatusBarMagnifierWidget( QWidget* parent ) :
QWidget( parent )
QgsStatusBarMagnifierWidget::QgsStatusBarMagnifierWidget( QWidget* parent )
: QWidget( parent )
{
QSettings settings;
int minimumFactor = ( int ) 100 * settings.value( "/qgis/magnifier_factor_min", 0.1 ).toDouble();
int maximumFactor = ( int ) 100 * settings.value( "/qgis/magnifier_factor_max", 10 ).toDouble();
int defaultFactor = ( int ) 100 * settings.value( "/qgis/magnifier_factor_default", 1.0 ).toDouble();

// label
mLabel = new QLabel( this );
mLabel = new QLabel();
mLabel->setMinimumWidth( 10 );
mLabel->setMargin( 3 );
mLabel->setAlignment( Qt::AlignCenter );
mLabel->setFrameStyle( QFrame::NoFrame );
mLabel->setText( tr( "Magnifier" ) );
mLabel->setToolTip( tr( "Magnifier" ) );

mSpinBox = new QgsDoubleSpinBox( this );
mSpinBox = new QgsDoubleSpinBox();
mSpinBox->setSuffix( "%" );
mSpinBox->setKeyboardTracking( false );
mSpinBox->setMaximumWidth( 120 );
@@ -37,9 +37,8 @@ class APP_EXPORT QgsStatusBarMagnifierWidget : public QWidget

/** Constructor
* @param parent is the parent widget
* @param canvas the map canvas
*/
QgsStatusBarMagnifierWidget( QWidget* parent = 0 );
QgsStatusBarMagnifierWidget( QWidget* parent = nullptr );

/** Destructor */
virtual ~QgsStatusBarMagnifierWidget();
@@ -30,8 +30,8 @@ QgsStatusBarScaleWidget::QgsStatusBarScaleWidget( QgsMapCanvas *canvas, QWidget
, mMapCanvas( canvas )
{
// add a label to show current scale
mLabel = new QLabel( QString(), this );
mLabel->setObjectName( "mScaleLable" );
mLabel = new QLabel();
mLabel->setObjectName( "mScaleLabel" );
mLabel->setMinimumWidth( 10 );
//mScaleLabel->setMaximumHeight( 20 );
mLabel->setMargin( 3 );
@@ -40,7 +40,7 @@ QgsStatusBarScaleWidget::QgsStatusBarScaleWidget( QgsMapCanvas *canvas, QWidget
mLabel->setText( tr( "Scale" ) );
mLabel->setToolTip( tr( "Current map scale" ) );

mScale = new QgsScaleComboBox( this );
mScale = new QgsScaleComboBox();
mScale->setObjectName( "mScaleEdit" );
// seems setFont() change font only for popup not for line edit,
// so we need to set font for it separately
@@ -49,7 +49,7 @@ QgsStatusBarScaleWidget::QgsStatusBarScaleWidget( QgsMapCanvas *canvas, QWidget
mScale->setWhatsThis( tr( "Displays the current map scale" ) );
mScale->setToolTip( tr( "Current map scale (formatted as x:y)" ) );

mLockButton = new QToolButton( this );
mLockButton = new QToolButton();
mLockButton->setIcon( QIcon( QgsApplication::getThemeIcon( "/locked.svg" ) ) );
mLockButton->setToolTip( tr( "Lock the scale to use magnifier to zoom in or out." ) );
mLockButton->setCheckable( true );
@@ -80,7 +80,7 @@ void QgsStatusBarScaleWidget::setScale( double scale )
mScale->setScale( scale );
}

bool QgsStatusBarScaleWidget::isLocked()
bool QgsStatusBarScaleWidget::isLocked() const
{
return mLockButton->isChecked();
}
@@ -96,7 +96,7 @@ void QgsStatusBarScaleWidget::updateScales( const QStringList &scales )
mScale->updateScales( scales );
}

void QgsStatusBarScaleWidget::userScale()
void QgsStatusBarScaleWidget::userScale() const
{
// Why has MapCanvas the scale inverted?
mMapCanvas->zoomScale( 1.0 / mScale->scale() );
@@ -52,7 +52,7 @@ class APP_EXPORT QgsStatusBarScaleWidget : public QWidget
* @brief isLocked check if the scale should be locked to use magnifier instead of scale to zoom in/out
* @return True if the scale shall be locked
*/
bool isLocked();
bool isLocked() const;

/** Set the font of the text
* @param font the font to use
@@ -63,7 +63,7 @@ class APP_EXPORT QgsStatusBarScaleWidget : public QWidget
void updateScales( const QStringList &scales = QStringList() );

private slots:
void userScale();
void userScale() const;

signals:
void scaleLockChanged( bool );
@@ -74,7 +74,7 @@ void QgsMapRendererCustomPainterJob::start()
#ifndef QT_NO_DEBUG
QPaintDevice* thePaintDevice = mPainter->device();
QString errMsg = QString( "pre-set DPI not equal to painter's DPI (%1 vs %2)" ).arg( thePaintDevice->logicalDpiX() ).arg( mSettings.outputDpi() );
Q_ASSERT_X( thePaintDevice->logicalDpiX() == mSettings.outputDpi(), "Job::startRender()", errMsg.toAscii().data() );
Q_ASSERT_X( qgsDoubleNear( thePaintDevice->logicalDpiX(), mSettings.outputDpi() ), "Job::startRender()", errMsg.toAscii().data() );
#endif

delete mLabelingEngine;

0 comments on commit 497d6ef

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