QGIS API Documentation 4.1.0-Master (376402f9aeb)
Loading...
Searching...
No Matches
qgssettingsregistrygui.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgssettingsregistrygui.cpp
3 --------------------------------------
4 Date : July 2021
5 Copyright : (C) 2021 by Damiano Lombardi
6 Email : damiano at opengis dot ch
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
18#include "qgsabstractdbsourceselect.h"
19#include "qgsaddtaborgroup.h"
21#include "qgsapplication.h"
22#include "qgscodeeditor.h"
23#include "qgscolorwidgets.h"
24#include "qgsdualview.h"
27#include "qgshistogramwidget.h"
28#include "qgsmapcanvas.h"
29#include "qgsmaptool.h"
30#include "qgsmaptoolidentify.h"
32#include "qgssettings.h"
37
38#include <QString>
39
40using namespace Qt::StringLiterals;
41
43
45 = new QgsSettingsEntryBool( u"floater-active"_s, QgsSettingsTree::sTreeCad, false, u"Whether the CAD floater widget is active"_s );
46
48 = new QgsSettingsEntryBool( u"show-markers"_s, QgsSettingsTree::sTreeRasterHistogram, false, u"Whether to show markers on the raster histogram"_s );
49
51 = new QgsSettingsEntryBool( u"zoom-to-min-max"_s, QgsSettingsTree::sTreeRasterHistogram, false, u"Whether to zoom the raster histogram to min/max values"_s );
52
54 = new QgsSettingsEntryBool( u"update-style-to-min-max"_s, QgsSettingsTree::sTreeRasterHistogram, true, u"Whether to update the style when histogram changes to min/max values"_s );
55
57 = new QgsSettingsEntryBool( u"draw-lines"_s, QgsSettingsTree::sTreeRasterHistogram, true, u"Whether to draw the raster histogram as lines"_s );
58
59const QgsSettingsEntryDouble *QgsSettingsRegistryGui::settingsZoomFactor = new QgsSettingsEntryDouble( u"zoom-factor"_s, QgsSettingsTree::sTreeQgis, 2.0, u"Zoom factor for map canvas and other views"_s );
60
62 = new QgsSettingsEntryBool( u"reverse-wheel-zoom"_s, QgsSettingsTree::sTreeQgis, false, u"Whether to reverse the direction of wheel zoom"_s );
63
65 = new QgsSettingsEntryBool( u"new-layers-visible"_s, QgsSettingsTree::sTreeQgis, true, u"Whether newly added layers are visible by default"_s );
66
68 = new QgsSettingsEntryString( u"default-palette"_s, QgsSettingsTree::sTreeRaster, QString(), u"Default color ramp palette name for raster layers"_s );
69
71 = new QgsSettingsEntryInteger( u"message-timeout"_s, QgsSettingsTree::sTreeQgis, 5, u"Timeout in seconds for message bar messages"_s );
72
74 = new QgsSettingsEntryBool( u"enable-anti-aliasing"_s, QgsSettingsTree::sTreeQgis, true, u"Whether anti-aliasing is enabled for rendering"_s );
75
77 = new QgsSettingsEntryBool( u"native-color-dialogs"_s, QgsSettingsTree::sTreeQgis, false, u"Whether to use native color dialogs"_s );
78
80 = new QgsSettingsEntryBool( u"format-layer-name"_s, QgsSettingsTree::sTreeQgis, false, u"Whether to format layer names for better readability"_s );
81
83 = new QgsSettingsEntryBool( u"open-sublayers-in-group"_s, QgsSettingsTree::sTreeQgis, false, u"Whether to open sublayers in a group"_s );
84
86 = new QgsSettingsEntryInteger( u"map-update-interval"_s, QgsSettingsTree::sTreeQgis, 250, u"Map update interval in milliseconds"_s );
87
89 = new QgsSettingsEntryDouble( u"magnifier-factor-default"_s, QgsSettingsTree::sTreeQgis, 1.0, u"Default magnifier factor"_s );
90
92 = new QgsSettingsEntryDouble( u"segmentation-tolerance"_s, QgsSettingsTree::sTreeQgis, 0.01745, u"Segmentation tolerance for curved geometries"_s );
93
95 = new QgsSettingsEntryColor( u"default-measure-color"_s, QgsSettingsTree::sTreeQgis, QColor( 222, 155, 67 ), u"Default measure tool color"_s );
96
98 QgsAbstractGeometry::SegmentationToleranceType>( u"segmentation-tolerance-type"_s, QgsSettingsTree::sTreeQgis, QgsAbstractGeometry::MaximumAngle, u"Segmentation tolerance type for curved geometries"_s );
99
102{
103 // copy values from old keys to new keys and delete the old ones
104 // for backward compatibility, old keys are recreated when the registry gets deleted
105
106 // TODO: remove in QGIS 4.4 (after LTR 4.2)
107
109
110 // single settings - added in 3.30
111 settingsRespectScreenDPI->copyValueFromKey( u"gui/qgis/respect_screen_dpi"_s, {}, true );
112
113 // single settings - added in 4.2
114 settingsCadFloaterActive->copyValueFromKey( u"/Cad/Floater"_s, true );
115 QgsAdvancedDigitizingDockWidget::settingsCadCommonAngle->copyValueFromKey( u"/Cad/CommonAngle"_s, true );
116 QgsMapCanvas::settingsCustomCoordinateCrs->copyValueFromKey( u"qgis/custom_coordinate_crs"_s, true );
117 QgsGradientColorRampDialog::settingsPlotHue->copyValueFromKey( u"GradientEditor/plotHue"_s, true );
118 QgsGradientColorRampDialog::settingsPlotLightness->copyValueFromKey( u"GradientEditor/plotLightness"_s, true );
119 QgsGradientColorRampDialog::settingsPlotSaturation->copyValueFromKey( u"GradientEditor/plotSaturation"_s, true );
120 QgsGradientColorRampDialog::settingsPlotAlpha->copyValueFromKey( u"GradientEditor/plotAlpha"_s, true );
121 QgsColorTextWidget::settingsTextFormat->copyValueFromKey( u"ColorWidgets/textWidgetFormat"_s, true );
122 QgsRendererMeshPropertiesWidget::settingsTab->copyValueFromKey( u"/Windows/RendererMeshProperties/tab"_s, true );
123 QgsMapToolIdentify::settingIdentifyMode->copyValueFromKey( u"Map/identifyMode"_s, true );
124 QgsMapToolIdentify::settingIdentifyMode->copyValueFromKey( u"/Map/identifyMode"_s, true );
125 QgsHistogramWidget::settingsHistogramShowMean->copyValueFromKey( u"HistogramWidget/showMean"_s, true );
126 QgsHistogramWidget::settingsHistogramShowStdev->copyValueFromKey( u"HistogramWidget/showStdev"_s, true );
127 settingsRasterHistogramShowMarkers->copyValueFromKey( u"Raster/histogram/showMarkers"_s, true );
128 settingsRasterHistogramZoomToMinMax->copyValueFromKey( u"Raster/histogram/zoomToMinMax"_s, true );
129 settingsRasterHistogramUpdateStyleToMinMax->copyValueFromKey( u"Raster/histogram/updateStyleToMinMax"_s, true );
130 settingsRasterHistogramDrawLines->copyValueFromKey( u"Raster/histogram/drawLines"_s, true );
131 settingsZoomFactor->copyValueFromKey( u"qgis/zoom_factor"_s, true );
132 settingsZoomFactor->copyValueFromKey( u"/qgis/zoom_factor"_s, true );
133 settingsReverseWheelZoom->copyValueFromKey( u"qgis/reverse_wheel_zoom"_s, true );
134 settingsReverseWheelZoom->copyValueFromKey( u"/qgis/reverse_wheel_zoom"_s, true );
135 settingsNewLayersVisible->copyValueFromKey( u"qgis/new_layers_visible"_s, true );
136 settingsNewLayersVisible->copyValueFromKey( u"/qgis/new_layers_visible"_s, true );
137 settingsRasterDefaultPalette->copyValueFromKey( u"Raster/defaultPalette"_s, true );
138 settingsRasterDefaultPalette->copyValueFromKey( u"/Raster/defaultPalette"_s, true );
139 settingsMessageTimeout->copyValueFromKey( u"qgis/messageTimeout"_s, true );
140 settingsMessageTimeout->copyValueFromKey( u"/qgis/messageTimeout"_s, true );
141 settingsEnableAntiAliasing->copyValueFromKey( u"qgis/enable_anti_aliasing"_s, true );
142 settingsEnableAntiAliasing->copyValueFromKey( u"/qgis/enable_anti_aliasing"_s, true );
143 settingsNativeColorDialogs->copyValueFromKey( u"qgis/native_color_dialogs"_s, true );
144 settingsNativeColorDialogs->copyValueFromKey( u"/qgis/native_color_dialogs"_s, true );
145 settingsFormatLayerName->copyValueFromKey( u"qgis/formatLayerName"_s, true );
146 settingsFormatLayerName->copyValueFromKey( u"/qgis/formatLayerName"_s, true );
147 settingsOpenSublayersInGroup->copyValueFromKey( u"qgis/openSublayersInGroup"_s, true );
148 settingsOpenSublayersInGroup->copyValueFromKey( u"/qgis/openSublayersInGroup"_s, true );
149 settingsMapUpdateInterval->copyValueFromKey( u"qgis/map_update_interval"_s, true );
150 settingsMapUpdateInterval->copyValueFromKey( u"/qgis/map_update_interval"_s, true );
151 settingsMagnifierFactorDefault->copyValueFromKey( u"qgis/magnifier_factor_default"_s, true );
152 settingsMagnifierFactorDefault->copyValueFromKey( u"/qgis/magnifier_factor_default"_s, true );
153 settingsSegmentationTolerance->copyValueFromKey( u"qgis/segmentationTolerance"_s, true );
154 settingsSegmentationTolerance->copyValueFromKey( u"/qgis/segmentationTolerance"_s, true );
155 settingsDefaultMeasureColor->copyValueFromKeys( u"qgis/default_measure_color_red"_s, u"qgis/default_measure_color_green"_s, u"qgis/default_measure_color_blue"_s, QString(), true );
156 settingsDefaultMeasureColor->copyValueFromKeys( u"/qgis/default_measure_color_red"_s, u"/qgis/default_measure_color_green"_s, u"/qgis/default_measure_color_blue"_s, QString(), true );
157 settingsSegmentationToleranceType->copyValueFromKey( u"qgis/segmentationToleranceType"_s, true );
158 settingsSegmentationToleranceType->copyValueFromKey( u"/qgis/segmentationToleranceType"_s, true );
159 QgsFeatureFilterModel::settingsMaxEntriesRelationWidget->copyValueFromKey( u"gui/maxEntriesRelationWidget"_s, true );
160 QgsCodeEditor::settingFontFamily->copyValueFromKey( u"gui/codeEditor/fontfamily"_s, true );
161 QgsCodeEditor::settingFontSize->copyValueFromKey( u"gui/codeEditor/fontsize"_s, true );
162 QgsMapTool::settingSearchRadiusMM->copyValueFromKey( u"Map/searchRadiusMM"_s, true );
163 QgsMapTool::settingSearchRadiusMM->copyValueFromKey( u"/Map/searchRadiusMM"_s, true );
164 QgsAddAttributeFormContainerDialog::settingsDefaultTabColumnCount->copyValueFromKey( u"qgis/attributeForm/defaultTabColumnCount"_s, true );
165 QgsAddAttributeFormContainerDialog::settingsDefaultTabColumnCount->copyValueFromKey( u"/qgis/attributeForm/defaultTabColumnCount"_s, true );
166 QgsAddAttributeFormContainerDialog::settingsDefaultGroupColumnCount->copyValueFromKey( u"qgis/attributeForm/defaultGroupColumnCount"_s, true );
167 QgsAddAttributeFormContainerDialog::settingsDefaultGroupColumnCount->copyValueFromKey( u"/qgis/attributeForm/defaultGroupColumnCount"_s, true );
168 QgsDualView::settingsFeatureListHighlightFeature->copyValueFromKey( u"qgis/attributeTable/featureListHighlightFeature"_s, true );
169 QgsDualView::settingsFeatureListHighlightFeature->copyValueFromKey( u"/qgis/attributeTable/featureListHighlightFeature"_s, true );
170
171 QgsAbstractDbSourceSelect::settingHoldDialogOpen->copyValueFromKey( u"ogr/GPKGSourceSelect/HoldDialogOpen"_s, { u"ogr/GPKGSourceSelect"_s }, true );
172 QgsAbstractDbSourceSelect::settingHoldDialogOpen->copyValueFromKey( u"ogr/SQLiteSourceSelect/HoldDialogOpen"_s, { u"ogr/SQLiteSourceSelect"_s }, true );
173 QgsAbstractDbSourceSelect::settingHoldDialogOpen->copyValueFromKey( u"Windows/MSSQLSourceSelect/HoldDialogOpen"_s, { u"MSSQLSourceSelect"_s }, true );
174 QgsAbstractDbSourceSelect::settingHoldDialogOpen->copyValueFromKey( u"Windows/PgSourceSelect/HoldDialogOpen"_s, { u"PgSourceSelect"_s }, true );
175 QgsAbstractDbSourceSelect::settingHoldDialogOpen->copyValueFromKey( u"Windows/SpatiaLiteSourceSelect/HoldDialogOpen"_s, { u"SpatiaLiteSourceSelect"_s }, true );
176
178}
179
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
@ MaximumAngle
Maximum angle between generating radii (lines from arc center to output vertices).
static const QgsSettingsEntryInteger * settingsDefaultGroupColumnCount
Settings entry for the default column count for group box containers.
static const QgsSettingsEntryInteger * settingsDefaultTabColumnCount
Settings entry for the default column count for tab containers.
static const QgsSettingsEntryDouble * settingsCadCommonAngle
static const QgsSettingsEntryString * settingFontFamily
Settings entry for code editor font family override.
static const QgsSettingsEntryInteger * settingFontSize
Settings entry for code editor font size override.
static const QgsSettingsEntryEnumFlag< ColorTextFormat > * settingsTextFormat
static const QgsSettingsEntryBool * settingsFeatureListHighlightFeature
Settings entry for whether features are highlighted/flashed in the feature list.
Definition qgsdualview.h:90
static const QgsSettingsEntryInteger * settingsMaxEntriesRelationWidget
Settings for maximum number of entries in relation widget.
static const QgsSettingsEntryBool * settingsPlotSaturation
static const QgsSettingsEntryBool * settingsPlotHue
static const QgsSettingsEntryBool * settingsPlotAlpha
static const QgsSettingsEntryBool * settingsPlotLightness
static const QgsSettingsEntryBool * settingsHistogramShowStdev
static const QgsSettingsEntryBool * settingsHistogramShowMean
static const QgsSettingsEntryString * settingsCustomCoordinateCrs
static const QgsSettingsEntryEnumFlag< IdentifyMode > * settingIdentifyMode
static const QgsSettingsEntryDouble * settingSearchRadiusMM
Settings entry for the search/identify radius in mm.
Definition qgsmaptool.h:233
static const QgsSettingsEntryInteger * settingsTab
A boolean settings entry.
A color settings entry.
A double settings entry.
A template class for enum and flag settings entry.
An integer settings entry.
A string settings entry.
static const QgsSettingsEntryInteger * settingsMessageTimeout
Settings entry message timeout in seconds.
static const QgsSettingsEntryBool * settingsEnableAntiAliasing
Settings entry whether anti-aliasing is enabled for rendering.
static const QgsSettingsEntryDouble * settingsSegmentationTolerance
Settings entry segmentation tolerance for curved geometries.
static const QgsSettingsEntryBool * settingsRasterHistogramDrawLines
Settings entry raster histogram draw lines.
static const QgsSettingsEntryBool * settingsRasterHistogramZoomToMinMax
Settings entry raster histogram zoom to min/max.
static const QgsSettingsEntryInteger * settingsMapUpdateInterval
Settings entry map update interval in milliseconds.
static const QgsSettingsEntryBool * settingsOpenSublayersInGroup
Settings entry whether to open sublayers in a group.
static const QgsSettingsEntryBool * settingsRasterHistogramUpdateStyleToMinMax
Settings entry raster histogram update style to min/max.
static const QgsSettingsEntryColor * settingsDefaultMeasureColor
Settings entry default measure tool color.
static const QgsSettingsEntryBool * settingsNewLayersVisible
Settings entry whether newly added layers are visible.
static const QgsSettingsEntryBool * settingsRespectScreenDPI
Settings entry respect screen dpi.
static const QgsSettingsEntryEnumFlag< QgsAbstractGeometry::SegmentationToleranceType > * settingsSegmentationToleranceType
Settings entry segmentation tolerance type for curved geometries.
static const QgsSettingsEntryBool * settingsRasterHistogramShowMarkers
Settings entry raster histogram show markers.
static const QgsSettingsEntryDouble * settingsZoomFactor
Settings entry zoom factor.
static const QgsSettingsEntryBool * settingsCadFloaterActive
Settings entry CAD floater active state.
static const QgsSettingsEntryBool * settingsFormatLayerName
Settings entry whether to format layer names.
static const QgsSettingsEntryBool * settingsReverseWheelZoom
Settings entry reverse wheel zoom.
static const QgsSettingsEntryDouble * settingsMagnifierFactorDefault
Settings entry default magnifier factor.
static const QgsSettingsEntryString * settingsRasterDefaultPalette
Settings entry default raster color ramp palette name.
static const QgsSettingsEntryBool * settingsNativeColorDialogs
Settings entry whether to use native color dialogs.
static QgsSettingsTreeNode * sTreeRasterHistogram
static QgsSettingsTreeNode * sTreeGui
static QgsSettingsTreeNode * sTreeRaster
static QgsSettingsTreeNode * sTreeQgis
static QgsSettingsTreeNode * sTreeCad
static void releaseFlush()
Releases a previously made hold on flushing QgsSettings objects and writing new values to the underly...
static void holdFlush()
Temporarily places a hold on flushing QgsSettings objects and writing new values to the underlying in...