Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use settings entry
  • Loading branch information
domi4484 committed Jul 8, 2021
1 parent 2705e01 commit ded3d0d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/options/qgsoptions.cpp
Expand Up @@ -740,7 +740,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mMapTipsDelaySpinBox->setValue( mSettings->value( QStringLiteral( "qgis/mapTipsDelay" ), 850 ).toInt() );
mMapTipsDelaySpinBox->setClearValue( 850 );

mRespectScreenDpiCheckBox->setChecked( mSettings->value( QStringLiteral( "qgis/respect_screen_dpi" ), QStringLiteral( "false" ), QgsSettings::Section::Gui ) == QStringLiteral( "true" ) );
mRespectScreenDpiCheckBox->setChecked( QgsSettingsRegistryCore::settingsRespectScreenDPI.value() );

//
// Raster properties
Expand Down Expand Up @@ -1608,7 +1608,7 @@ void QgsOptions::saveOptions()

mSettings->setValue( QStringLiteral( "/qgis/defaultLegendGraphicResolution" ), mLegendGraphicResolutionSpinBox->value() );
mSettings->setValue( QStringLiteral( "/qgis/mapTipsDelay" ), mMapTipsDelaySpinBox->value() );
mSettings->setValue( QStringLiteral( "qgis/respect_screen_dpi" ), mRespectScreenDpiCheckBox->isChecked() ? QStringLiteral( "true" ) : QStringLiteral( "false" ), QgsSettings::Section::Gui );
QgsSettingsRegistryCore::settingsRespectScreenDPI.setValue( mRespectScreenDpiCheckBox->isChecked() );

mSettings->setEnumValue( QStringLiteral( "/qgis/copyFeatureFormat" ), ( QgsClipboard::CopyFormat )mComboCopyFeatureFormat->currentData().toInt() );
QgisApp::instance()->setMapTipsDelay( mMapTipsDelaySpinBox->value() );
Expand Down
1 change: 1 addition & 0 deletions src/core/settings/qgssettingsregistrycore.cpp
Expand Up @@ -95,6 +95,7 @@ QgsSettingsRegistryCore::QgsSettingsRegistryCore()
addSettingsEntry( &settingsDigitizingOffsetCapStyle );
addSettingsEntry( &settingsDigitizingOffsetShowAdvanced );
addSettingsEntry( &settingsDigitizingTracingMaxFeatureCount );
addSettingsEntry( &settingsRespectScreenDPI );
}

QgsSettingsRegistryCore::~QgsSettingsRegistryCore()
Expand Down
3 changes: 3 additions & 0 deletions src/core/settings/qgssettingsregistrycore.h
Expand Up @@ -170,6 +170,9 @@ class CORE_EXPORT QgsSettingsRegistryCore : public QgsSettingsRegistry

//! Settings entry digitizing tracing max feature count
static const inline QgsSettingsEntryInteger settingsDigitizingTracingMaxFeatureCount = QgsSettingsEntryInteger( QStringLiteral( "/qgis/digitizing/tracing_max_feature_count" ), QgsSettings::NoSection, 10000 );

//! Settings entry respect screen dpi
static const inline QgsSettingsEntryBool settingsRespectScreenDPI = QgsSettingsEntryBool( QStringLiteral( "qgis/respect_screen_dpi" ), QgsSettings::Gui, false );
#endif

};
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Expand Up @@ -91,6 +91,7 @@ email : sherman at mrcc.com
#include "qgscoordinatereferencesystemregistry.h"
#include "qgslabelingresults.h"
#include "qgsmaplayerutils.h"
#include "qgssettingsregistrycore.h"

/**
* \ingroup gui
Expand Down Expand Up @@ -984,7 +985,7 @@ void QgsMapCanvas::updateDevicePixelFromScreen()
{
mSettings.setDevicePixelRatio( devicePixelRatio() );
// TODO: QGIS 4 -> always respect screen dpi
if ( QgsSettings().value( QStringLiteral( "qgis/respect_screen_dpi" ), QStringLiteral( "false" ), QgsSettings::Section::Gui ) == QLatin1String( "true" ) )
if ( QgsSettingsRegistryCore::settingsRespectScreenDPI.value() )
{
mSettings.setOutputDpi( screen()->physicalDotsPerInch() );
}
Expand Down

0 comments on commit ded3d0d

Please sign in to comment.