Skip to content

Commit 6ed0b47

Browse files
committedJan 8, 2019
[FEATURE][georefencer] Make minimizing georeferencer when adding points
from canvas an option Allows users to disable this option, which is annoying on multi-monitor setups where it can be desirable to have both windows visible while adding points. The option is added as a checkbox in the "add map coordinates" dialog: "Automatically hide georeferencer window". We show it directly in that dialog for maximum discoverability, and to allow easier change of setting for users who move between single/multi monitor setups. Fixes #20449
1 parent 0de94dd commit 6ed0b47

File tree

4 files changed

+105
-115
lines changed

4 files changed

+105
-115
lines changed
 

‎src/plugins/georeferencer/qgsgeorefconfigdialog.cpp

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -91,32 +91,9 @@ void QgsGeorefConfigDialog::buttonBox_rejected()
9191
void QgsGeorefConfigDialog::readSettings()
9292
{
9393
QgsSettings s;
94-
if ( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowId" ) ).toBool() )
95-
{
96-
mShowIDsCheckBox->setChecked( true );
97-
}
98-
else
99-
{
100-
mShowIDsCheckBox->setChecked( false );
101-
}
102-
103-
if ( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowCoords" ) ).toBool() )
104-
{
105-
mShowCoordsCheckBox->setChecked( true );
106-
}
107-
else
108-
{
109-
mShowCoordsCheckBox->setChecked( false );
110-
}
111-
112-
if ( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowDocked" ) ).toBool() )
113-
{
114-
mShowDockedCheckBox->setChecked( true );
115-
}
116-
else
117-
{
118-
mShowDockedCheckBox->setChecked( false );
119-
}
94+
mShowIDsCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowId" ) ).toBool() );
95+
mShowCoordsCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowCoords" ) ).toBool() );
96+
mShowDockedCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowDocked" ) ).toBool() );
12097

12198
if ( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ResidualUnits" ) ).toString() == QLatin1String( "mapUnits" ) )
12299
{

‎src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,31 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>309</width>
10-
<height>443</height>
9+
<width>478</width>
10+
<height>542</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
1414
<string>Configure Georeferencer</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout_4">
17+
<item row="5" column="0">
18+
<spacer name="verticalSpacer">
19+
<property name="orientation">
20+
<enum>Qt::Vertical</enum>
21+
</property>
22+
<property name="sizeHint" stdset="0">
23+
<size>
24+
<width>20</width>
25+
<height>40</height>
26+
</size>
27+
</property>
28+
</spacer>
29+
</item>
1730
<item row="0" column="0">
1831
<widget class="QGroupBox" name="mPointTipGroupBox">
1932
<property name="title">
20-
<string>Point tip</string>
33+
<string>Point Tip</string>
2134
</property>
2235
<layout class="QGridLayout" name="gridLayout">
2336
<item row="0" column="0">
@@ -37,33 +50,50 @@
3750
</layout>
3851
</widget>
3952
</item>
40-
<item row="1" column="0">
41-
<widget class="QGroupBox" name="mResidualUnitsGroupBox">
53+
<item row="4" column="0">
54+
<widget class="QCheckBox" name="mShowDockedCheckBox">
55+
<property name="text">
56+
<string>Show Georeferencer window docked</string>
57+
</property>
58+
</widget>
59+
</item>
60+
<item row="6" column="0">
61+
<widget class="QDialogButtonBox" name="buttonBox">
62+
<property name="orientation">
63+
<enum>Qt::Horizontal</enum>
64+
</property>
65+
<property name="standardButtons">
66+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
67+
</property>
68+
</widget>
69+
</item>
70+
<item row="3" column="0">
71+
<widget class="QGroupBox" name="groupBox">
4272
<property name="title">
43-
<string>Residual units</string>
73+
<string>PDF Map</string>
4474
</property>
45-
<layout class="QGridLayout" name="gridLayout_3">
75+
<layout class="QGridLayout" name="gridLayout_5">
4676
<item row="0" column="0">
47-
<widget class="QRadioButton" name="mPixelsButton">
48-
<property name="text">
49-
<string>Pixels</string>
50-
</property>
51-
</widget>
52-
</item>
53-
<item row="1" column="0">
54-
<widget class="QRadioButton" name="mMapUnitsButton">
55-
<property name="text">
56-
<string>Use map units if possible</string>
57-
</property>
58-
</widget>
77+
<layout class="QHBoxLayout" name="horizontalLayout_3">
78+
<item>
79+
<widget class="QLabel" name="label_3">
80+
<property name="text">
81+
<string>Paper size</string>
82+
</property>
83+
</widget>
84+
</item>
85+
<item>
86+
<widget class="QComboBox" name="mPaperSizeComboBox"/>
87+
</item>
88+
</layout>
5989
</item>
6090
</layout>
6191
</widget>
6292
</item>
6393
<item row="2" column="0">
6494
<widget class="QGroupBox" name="mPdfReportGroupBox">
6595
<property name="title">
66-
<string>PDF report</string>
96+
<string>PDF Report</string>
6797
</property>
6898
<layout class="QGridLayout" name="gridLayout_2">
6999
<item row="0" column="0">
@@ -114,59 +144,29 @@
114144
</layout>
115145
</widget>
116146
</item>
117-
<item row="4" column="0">
118-
<widget class="QCheckBox" name="mShowDockedCheckBox">
119-
<property name="text">
120-
<string>Show Georeferencer window docked</string>
121-
</property>
122-
</widget>
123-
</item>
124-
<item row="6" column="0">
125-
<widget class="QDialogButtonBox" name="buttonBox">
126-
<property name="orientation">
127-
<enum>Qt::Horizontal</enum>
128-
</property>
129-
<property name="standardButtons">
130-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
131-
</property>
132-
</widget>
133-
</item>
134-
<item row="3" column="0">
135-
<widget class="QGroupBox" name="groupBox">
147+
<item row="1" column="0">
148+
<widget class="QGroupBox" name="mResidualUnitsGroupBox">
136149
<property name="title">
137-
<string>PDF map</string>
150+
<string>Residual Units</string>
138151
</property>
139-
<layout class="QGridLayout" name="gridLayout_5">
152+
<layout class="QGridLayout" name="gridLayout_3">
140153
<item row="0" column="0">
141-
<layout class="QHBoxLayout" name="horizontalLayout_3">
142-
<item>
143-
<widget class="QLabel" name="label_3">
144-
<property name="text">
145-
<string>Paper size</string>
146-
</property>
147-
</widget>
148-
</item>
149-
<item>
150-
<widget class="QComboBox" name="mPaperSizeComboBox"/>
151-
</item>
152-
</layout>
154+
<widget class="QRadioButton" name="mPixelsButton">
155+
<property name="text">
156+
<string>Pixels</string>
157+
</property>
158+
</widget>
159+
</item>
160+
<item row="1" column="0">
161+
<widget class="QRadioButton" name="mMapUnitsButton">
162+
<property name="text">
163+
<string>Use map units if possible</string>
164+
</property>
165+
</widget>
153166
</item>
154167
</layout>
155168
</widget>
156169
</item>
157-
<item row="5" column="0">
158-
<spacer name="verticalSpacer">
159-
<property name="orientation">
160-
<enum>Qt::Vertical</enum>
161-
</property>
162-
<property name="sizeHint" stdset="0">
163-
<size>
164-
<width>20</width>
165-
<height>40</height>
166-
</size>
167-
</property>
168-
</spacer>
169-
</item>
170170
</layout>
171171
</widget>
172172
<customwidgets>

‎src/plugins/georeferencer/qgsmapcoordsdialog.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint
4646
mToolEmitPoint = new QgsGeorefMapToolEmitPoint( qgisCanvas );
4747
mToolEmitPoint->setButton( mPointFromCanvasPushButton );
4848

49+
mMinimizeWindowCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/Minimize" ), QStringLiteral( "1" ) ).toBool() );
50+
4951
connect( mPointFromCanvasPushButton, &QAbstractButton::clicked, this, &QgsMapCoordsDialog::setToolEmitPoint );
5052

5153
connect( mToolEmitPoint, &QgsGeorefMapToolEmitPoint::canvasClicked,
@@ -63,6 +65,7 @@ QgsMapCoordsDialog::~QgsMapCoordsDialog()
6365

6466
QgsSettings settings;
6567
settings.setValue( QStringLiteral( "/Plugin-GeoReferencer/MapCoordsWindow/geometry" ), saveGeometry() );
68+
settings.setValue( QStringLiteral( "/Plugin-GeoReferencer/Config/Minimize" ), mMinimizeWindowCheckBox->isChecked() );
6669
}
6770

6871
void QgsMapCoordsDialog::updateOK()
@@ -119,7 +122,10 @@ void QgsMapCoordsDialog::setToolEmitPoint( bool isEnable )
119122
{
120123
if ( isEnable )
121124
{
122-
parentWidget()->showMinimized();
125+
if ( mMinimizeWindowCheckBox->isChecked() )
126+
{
127+
parentWidget()->showMinimized();
128+
}
123129

124130
Q_ASSERT( parentWidget()->parentWidget() );
125131
parentWidget()->parentWidget()->activateWindow();

‎src/plugins/georeferencer/qgsmapcoordsdialogbase.ui

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>497</width>
10-
<height>204</height>
9+
<width>531</width>
10+
<height>212</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -17,6 +17,20 @@
1717
<bool>true</bool>
1818
</property>
1919
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0">
20+
<item row="1" column="0">
21+
<widget class="QLabel" name="textLabel1">
22+
<property name="text">
23+
<string>X / East</string>
24+
</property>
25+
</widget>
26+
</item>
27+
<item row="5" column="0" colspan="4">
28+
<widget class="QDialogButtonBox" name="buttonBox">
29+
<property name="standardButtons">
30+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
31+
</property>
32+
</widget>
33+
</item>
2034
<item row="0" column="0" colspan="4">
2135
<widget class="QLabel" name="label">
2236
<property name="text">
@@ -27,33 +41,13 @@
2741
</property>
2842
</widget>
2943
</item>
30-
<item row="1" column="3">
31-
<widget class="QLineEdit" name="leYCoord"/>
32-
</item>
3344
<item row="1" column="2">
3445
<widget class="QLabel" name="textLabel2">
3546
<property name="text">
3647
<string>Y / North</string>
3748
</property>
3849
</widget>
3950
</item>
40-
<item row="1" column="0">
41-
<widget class="QLabel" name="textLabel1">
42-
<property name="text">
43-
<string>X / East</string>
44-
</property>
45-
</widget>
46-
</item>
47-
<item row="1" column="1">
48-
<widget class="QLineEdit" name="leXCoord"/>
49-
</item>
50-
<item row="4" column="0" colspan="4">
51-
<widget class="QDialogButtonBox" name="buttonBox">
52-
<property name="standardButtons">
53-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
54-
</property>
55-
</widget>
56-
</item>
5751
<item row="3" column="0">
5852
<spacer name="verticalSpacer">
5953
<property name="orientation">
@@ -67,6 +61,19 @@
6761
</property>
6862
</spacer>
6963
</item>
64+
<item row="1" column="3">
65+
<widget class="QLineEdit" name="leYCoord"/>
66+
</item>
67+
<item row="1" column="1">
68+
<widget class="QLineEdit" name="leXCoord"/>
69+
</item>
70+
<item row="4" column="0" colspan="4">
71+
<widget class="QCheckBox" name="mMinimizeWindowCheckBox">
72+
<property name="text">
73+
<string>Automatically hide georeferencer window </string>
74+
</property>
75+
</widget>
76+
</item>
7077
</layout>
7178
</widget>
7279
<layoutdefault spacing="6" margin="11"/>

0 commit comments

Comments
 (0)
Please sign in to comment.