Skip to content

Commit

Permalink
Minor clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 29, 2016
1 parent 421ab4f commit 497d6ef
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/app/qgsstatusbarmagnifierwidget.cpp
Expand Up @@ -23,24 +23,24 @@
#include "qgsstatusbarmagnifierwidget.h" #include "qgsstatusbarmagnifierwidget.h"
#include "qgsdoublespinbox.h" #include "qgsdoublespinbox.h"


QgsStatusBarMagnifierWidget::QgsStatusBarMagnifierWidget( QWidget* parent ) : QgsStatusBarMagnifierWidget::QgsStatusBarMagnifierWidget( QWidget* parent )
QWidget( parent ) : QWidget( parent )
{ {
QSettings settings; QSettings settings;
int minimumFactor = ( int ) 100 * settings.value( "/qgis/magnifier_factor_min", 0.1 ).toDouble(); 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 maximumFactor = ( int ) 100 * settings.value( "/qgis/magnifier_factor_max", 10 ).toDouble();
int defaultFactor = ( int ) 100 * settings.value( "/qgis/magnifier_factor_default", 1.0 ).toDouble(); int defaultFactor = ( int ) 100 * settings.value( "/qgis/magnifier_factor_default", 1.0 ).toDouble();


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


mSpinBox = new QgsDoubleSpinBox( this ); mSpinBox = new QgsDoubleSpinBox();
mSpinBox->setSuffix( "%" ); mSpinBox->setSuffix( "%" );
mSpinBox->setKeyboardTracking( false ); mSpinBox->setKeyboardTracking( false );
mSpinBox->setMaximumWidth( 120 ); mSpinBox->setMaximumWidth( 120 );
Expand Down
3 changes: 1 addition & 2 deletions src/app/qgsstatusbarmagnifierwidget.h
Expand Up @@ -37,9 +37,8 @@ class APP_EXPORT QgsStatusBarMagnifierWidget : public QWidget


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


/** Destructor */ /** Destructor */
virtual ~QgsStatusBarMagnifierWidget(); virtual ~QgsStatusBarMagnifierWidget();
Expand Down
12 changes: 6 additions & 6 deletions src/app/qgsstatusbarscalewidget.cpp
Expand Up @@ -30,8 +30,8 @@ QgsStatusBarScaleWidget::QgsStatusBarScaleWidget( QgsMapCanvas *canvas, QWidget
, mMapCanvas( canvas ) , mMapCanvas( canvas )
{ {
// add a label to show current scale // add a label to show current scale
mLabel = new QLabel( QString(), this ); mLabel = new QLabel();
mLabel->setObjectName( "mScaleLable" ); mLabel->setObjectName( "mScaleLabel" );
mLabel->setMinimumWidth( 10 ); mLabel->setMinimumWidth( 10 );
//mScaleLabel->setMaximumHeight( 20 ); //mScaleLabel->setMaximumHeight( 20 );
mLabel->setMargin( 3 ); mLabel->setMargin( 3 );
Expand All @@ -40,7 +40,7 @@ QgsStatusBarScaleWidget::QgsStatusBarScaleWidget( QgsMapCanvas *canvas, QWidget
mLabel->setText( tr( "Scale" ) ); mLabel->setText( tr( "Scale" ) );
mLabel->setToolTip( tr( "Current map scale" ) ); mLabel->setToolTip( tr( "Current map scale" ) );


mScale = new QgsScaleComboBox( this ); mScale = new QgsScaleComboBox();
mScale->setObjectName( "mScaleEdit" ); mScale->setObjectName( "mScaleEdit" );
// seems setFont() change font only for popup not for line edit, // seems setFont() change font only for popup not for line edit,
// so we need to set font for it separately // so we need to set font for it separately
Expand All @@ -49,7 +49,7 @@ QgsStatusBarScaleWidget::QgsStatusBarScaleWidget( QgsMapCanvas *canvas, QWidget
mScale->setWhatsThis( tr( "Displays the current map scale" ) ); mScale->setWhatsThis( tr( "Displays the current map scale" ) );
mScale->setToolTip( tr( "Current map scale (formatted as x:y)" ) ); 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->setIcon( QIcon( QgsApplication::getThemeIcon( "/locked.svg" ) ) );
mLockButton->setToolTip( tr( "Lock the scale to use magnifier to zoom in or out." ) ); mLockButton->setToolTip( tr( "Lock the scale to use magnifier to zoom in or out." ) );
mLockButton->setCheckable( true ); mLockButton->setCheckable( true );
Expand Down Expand Up @@ -80,7 +80,7 @@ void QgsStatusBarScaleWidget::setScale( double scale )
mScale->setScale( scale ); mScale->setScale( scale );
} }


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


void QgsStatusBarScaleWidget::userScale() void QgsStatusBarScaleWidget::userScale() const
{ {
// Why has MapCanvas the scale inverted? // Why has MapCanvas the scale inverted?
mMapCanvas->zoomScale( 1.0 / mScale->scale() ); mMapCanvas->zoomScale( 1.0 / mScale->scale() );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsstatusbarscalewidget.h
Expand Up @@ -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 * @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 * @return True if the scale shall be locked
*/ */
bool isLocked(); bool isLocked() const;


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


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


signals: signals:
void scaleLockChanged( bool ); void scaleLockChanged( bool );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprenderercustompainterjob.cpp
Expand Up @@ -74,7 +74,7 @@ void QgsMapRendererCustomPainterJob::start()
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
QPaintDevice* thePaintDevice = mPainter->device(); 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() ); 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 #endif


delete mLabelingEngine; delete mLabelingEngine;
Expand Down

0 comments on commit 497d6ef

Please sign in to comment.