Skip to content

Commit cc0007c

Browse files
committedMar 7, 2017
Use a checkbox instead of tree item for "no projection" option
Makes this option more visible and easier to associate with the old "OTF off" option
1 parent 7dbe494 commit cc0007c

File tree

3 files changed

+229
-188
lines changed

3 files changed

+229
-188
lines changed
 

‎src/gui/qgsprojectionselectiontreewidget.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget( QWidget *par
6565

6666
mRecentProjections = QgsCoordinateReferenceSystem::recentProjections();
6767

68-
mNoProjItem = new QTreeWidgetItem( lstCoordinateSystems, QStringList( tr( "No projection" ) ) );
69-
mNoProjItem->setHidden( true );
68+
mCheckBoxNoProjection->setHidden( true );
69+
connect( mCheckBoxNoProjection, &QCheckBox::toggled, mFrameProjections, &QFrame::setDisabled );
7070
}
7171

7272
QgsProjectionSelectionTreeWidget::~QgsProjectionSelectionTreeWidget()
@@ -273,10 +273,11 @@ void QgsProjectionSelectionTreeWidget::setCrs( const QgsCoordinateReferenceSyste
273273
{
274274
if ( !crs.isValid() )
275275
{
276-
lstCoordinateSystems->setCurrentItem( mNoProjItem );
276+
mCheckBoxNoProjection->setChecked( true );
277277
}
278278
else
279279
{
280+
mCheckBoxNoProjection->setChecked( false );
280281
applySelection( AuthidColumn, crs.authid() );
281282
}
282283
}
@@ -424,7 +425,7 @@ QString QgsProjectionSelectionTreeWidget::getSelectedExpression( const QString &
424425

425426
QgsCoordinateReferenceSystem QgsProjectionSelectionTreeWidget::crs() const
426427
{
427-
if ( lstCoordinateSystems->currentItem() == mNoProjItem )
428+
if ( mCheckBoxNoProjection->isChecked() )
428429
return QgsCoordinateReferenceSystem();
429430

430431
int srid = getSelectedExpression( QStringLiteral( "srs_id" ) ).toLong();
@@ -436,18 +437,18 @@ QgsCoordinateReferenceSystem QgsProjectionSelectionTreeWidget::crs() const
436437

437438
void QgsProjectionSelectionTreeWidget::setShowNoProjection( bool show )
438439
{
439-
mNoProjItem->setHidden( !show );
440+
mCheckBoxNoProjection->setHidden( !show );
440441
}
441442

442443
bool QgsProjectionSelectionTreeWidget::showNoProjection() const
443444
{
444-
return !mNoProjItem->isHidden();
445+
return !mCheckBoxNoProjection->isHidden();
445446
}
446447

447448
bool QgsProjectionSelectionTreeWidget::hasValidSelection() const
448449
{
449450
QTreeWidgetItem *item = lstCoordinateSystems->currentItem();
450-
if ( item == mNoProjItem )
451+
if ( mCheckBoxNoProjection->isChecked() )
451452
return true;
452453
else
453454
return item && !item->text( QgisCrsIdColumn ).isEmpty();

‎src/gui/qgsprojectionselectiontreewidget.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ class GUI_EXPORT QgsProjectionSelectionTreeWidget : public QWidget, private Ui::
213213
QTreeWidgetItem *mGeoList = nullptr;
214214
//! PROJCS node
215215
QTreeWidgetItem *mProjList = nullptr;
216-
//! "No projection" item
217-
QTreeWidgetItem *mNoProjItem = nullptr;
218216

219217
//! Users custom coordinate system file
220218
QString mCustomCsFile;

‎src/ui/qgsprojectionselectorbase.ui

Lines changed: 221 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -21,147 +21,102 @@
2121
</property>
2222
<property name="windowIcon">
2323
<iconset>
24-
<normaloff/>
25-
</iconset>
24+
<normaloff>.</normaloff>.</iconset>
2625
</property>
2726
<layout class="QGridLayout" name="gridLayout_2">
28-
<property name="margin">
27+
<property name="leftMargin">
2928
<number>0</number>
3029
</property>
31-
<item row="3" column="0">
32-
<layout class="QHBoxLayout" name="horizontalLayout_2">
33-
<item>
34-
<widget class="QLabel" name="label">
35-
<property name="font">
36-
<font>
37-
<weight>75</weight>
38-
<bold>true</bold>
39-
</font>
40-
</property>
41-
<property name="text">
42-
<string>Selected CRS</string>
43-
</property>
44-
</widget>
45-
</item>
46-
<item>
47-
<widget class="QLineEdit" name="teSelected">
48-
<property name="readOnly">
49-
<bool>true</bool>
50-
</property>
51-
</widget>
52-
</item>
53-
</layout>
54-
</item>
55-
<item row="2" column="0">
56-
<widget class="QSplitter" name="splitter">
57-
<property name="orientation">
58-
<enum>Qt::Vertical</enum>
30+
<property name="topMargin">
31+
<number>0</number>
32+
</property>
33+
<property name="rightMargin">
34+
<number>0</number>
35+
</property>
36+
<property name="bottomMargin">
37+
<number>0</number>
38+
</property>
39+
<item row="1" column="0">
40+
<widget class="QFrame" name="mFrameProjections">
41+
<property name="frameShape">
42+
<enum>QFrame::NoFrame</enum>
5943
</property>
60-
<property name="childrenCollapsible">
61-
<bool>true</bool>
44+
<property name="frameShadow">
45+
<enum>QFrame::Plain</enum>
6246
</property>
63-
<widget class="QTreeWidget" name="lstRecent">
64-
<property name="sizePolicy">
65-
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
66-
<horstretch>0</horstretch>
67-
<verstretch>0</verstretch>
68-
</sizepolicy>
69-
</property>
70-
<property name="minimumSize">
71-
<size>
72-
<width>0</width>
73-
<height>105</height>
74-
</size>
75-
</property>
76-
<property name="maximumSize">
77-
<size>
78-
<width>16777215</width>
79-
<height>200</height>
80-
</size>
81-
</property>
82-
<property name="alternatingRowColors">
83-
<bool>true</bool>
47+
<layout class="QGridLayout" name="gridLayout_3">
48+
<property name="leftMargin">
49+
<number>0</number>
8450
</property>
85-
<property name="rootIsDecorated">
86-
<bool>false</bool>
51+
<property name="topMargin">
52+
<number>0</number>
8753
</property>
88-
<property name="uniformRowHeights">
89-
<bool>true</bool>
54+
<property name="rightMargin">
55+
<number>0</number>
9056
</property>
91-
<property name="columnCount">
92-
<number>3</number>
57+
<property name="bottomMargin">
58+
<number>0</number>
9359
</property>
94-
<column>
95-
<property name="text">
96-
<string>Coordinate Reference System</string>
97-
</property>
98-
</column>
99-
<column>
100-
<property name="text">
101-
<string>Authority ID</string>
102-
</property>
103-
</column>
104-
<column>
105-
<property name="text">
106-
<string>ID</string>
107-
</property>
108-
</column>
109-
</widget>
110-
<widget class="QWidget" name="layoutWidget">
111-
<layout class="QGridLayout" name="gridLayout">
112-
<property name="horizontalSpacing">
113-
<number>0</number>
114-
</property>
115-
<item row="0" column="0">
116-
<layout class="QHBoxLayout" name="horizontalLayout_3">
117-
<property name="topMargin">
118-
<number>0</number>
60+
<item row="1" column="0">
61+
<layout class="QHBoxLayout" name="horizontalLayout">
62+
<item>
63+
<widget class="QLabel" name="label_5">
64+
<property name="text">
65+
<string>Filter</string>
66+
</property>
67+
</widget>
68+
</item>
69+
<item>
70+
<widget class="QgsFilterLineEdit" name="leSearch"/>
71+
</item>
72+
</layout>
73+
</item>
74+
<item row="2" column="0">
75+
<widget class="QLabel" name="label_3">
76+
<property name="font">
77+
<font>
78+
<weight>75</weight>
79+
<bold>true</bold>
80+
</font>
81+
</property>
82+
<property name="text">
83+
<string>Recently used coordinate reference systems</string>
84+
</property>
85+
</widget>
86+
</item>
87+
<item row="3" column="0">
88+
<widget class="QSplitter" name="splitter">
89+
<property name="orientation">
90+
<enum>Qt::Vertical</enum>
91+
</property>
92+
<property name="childrenCollapsible">
93+
<bool>true</bool>
94+
</property>
95+
<widget class="QTreeWidget" name="lstRecent">
96+
<property name="sizePolicy">
97+
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
98+
<horstretch>0</horstretch>
99+
<verstretch>0</verstretch>
100+
</sizepolicy>
101+
</property>
102+
<property name="minimumSize">
103+
<size>
104+
<width>0</width>
105+
<height>105</height>
106+
</size>
107+
</property>
108+
<property name="maximumSize">
109+
<size>
110+
<width>16777215</width>
111+
<height>200</height>
112+
</size>
119113
</property>
120-
<item>
121-
<widget class="QLabel" name="label_4">
122-
<property name="font">
123-
<font>
124-
<weight>75</weight>
125-
<bold>true</bold>
126-
</font>
127-
</property>
128-
<property name="text">
129-
<string>Coordinate reference systems of the world</string>
130-
</property>
131-
</widget>
132-
</item>
133-
<item>
134-
<spacer name="horizontalSpacer_2">
135-
<property name="orientation">
136-
<enum>Qt::Horizontal</enum>
137-
</property>
138-
<property name="sizeHint" stdset="0">
139-
<size>
140-
<width>40</width>
141-
<height>20</height>
142-
</size>
143-
</property>
144-
</spacer>
145-
</item>
146-
<item>
147-
<widget class="QCheckBox" name="cbxHideDeprecated">
148-
<property name="font">
149-
<font>
150-
<pointsize>9</pointsize>
151-
</font>
152-
</property>
153-
<property name="text">
154-
<string>Hide deprecated CRSs</string>
155-
</property>
156-
</widget>
157-
</item>
158-
</layout>
159-
</item>
160-
<item row="1" column="0">
161-
<widget class="QTreeWidget" name="lstCoordinateSystems">
162114
<property name="alternatingRowColors">
163115
<bool>true</bool>
164116
</property>
117+
<property name="rootIsDecorated">
118+
<bool>false</bool>
119+
</property>
165120
<property name="uniformRowHeights">
166121
<bool>true</bool>
167122
</property>
@@ -184,63 +139,150 @@
184139
</property>
185140
</column>
186141
</widget>
187-
</item>
188-
</layout>
189-
</widget>
142+
<widget class="QWidget" name="layoutWidget">
143+
<layout class="QGridLayout" name="gridLayout">
144+
<property name="horizontalSpacing">
145+
<number>0</number>
146+
</property>
147+
<item row="0" column="0">
148+
<layout class="QHBoxLayout" name="horizontalLayout_3">
149+
<property name="topMargin">
150+
<number>0</number>
151+
</property>
152+
<item>
153+
<widget class="QLabel" name="label_4">
154+
<property name="font">
155+
<font>
156+
<weight>75</weight>
157+
<bold>true</bold>
158+
</font>
159+
</property>
160+
<property name="text">
161+
<string>Coordinate reference systems of the world</string>
162+
</property>
163+
</widget>
164+
</item>
165+
<item>
166+
<spacer name="horizontalSpacer_2">
167+
<property name="orientation">
168+
<enum>Qt::Horizontal</enum>
169+
</property>
170+
<property name="sizeHint" stdset="0">
171+
<size>
172+
<width>40</width>
173+
<height>20</height>
174+
</size>
175+
</property>
176+
</spacer>
177+
</item>
178+
<item>
179+
<widget class="QCheckBox" name="cbxHideDeprecated">
180+
<property name="font">
181+
<font>
182+
<pointsize>9</pointsize>
183+
</font>
184+
</property>
185+
<property name="text">
186+
<string>Hide deprecated CRSs</string>
187+
</property>
188+
</widget>
189+
</item>
190+
</layout>
191+
</item>
192+
<item row="1" column="0">
193+
<widget class="QTreeWidget" name="lstCoordinateSystems">
194+
<property name="alternatingRowColors">
195+
<bool>true</bool>
196+
</property>
197+
<property name="uniformRowHeights">
198+
<bool>true</bool>
199+
</property>
200+
<property name="columnCount">
201+
<number>3</number>
202+
</property>
203+
<column>
204+
<property name="text">
205+
<string>Coordinate Reference System</string>
206+
</property>
207+
</column>
208+
<column>
209+
<property name="text">
210+
<string>Authority ID</string>
211+
</property>
212+
</column>
213+
<column>
214+
<property name="text">
215+
<string>ID</string>
216+
</property>
217+
</column>
218+
</widget>
219+
</item>
220+
<item row="2" column="0">
221+
<layout class="QHBoxLayout" name="horizontalLayout_2">
222+
<item>
223+
<widget class="QLabel" name="label">
224+
<property name="font">
225+
<font>
226+
<weight>75</weight>
227+
<bold>true</bold>
228+
</font>
229+
</property>
230+
<property name="text">
231+
<string>Selected CRS</string>
232+
</property>
233+
</widget>
234+
</item>
235+
<item>
236+
<widget class="QLineEdit" name="teSelected">
237+
<property name="readOnly">
238+
<bool>true</bool>
239+
</property>
240+
</widget>
241+
</item>
242+
</layout>
243+
</item>
244+
</layout>
245+
</widget>
246+
</widget>
247+
</item>
248+
<item row="4" column="0">
249+
<widget class="QTextEdit" name="teProjection">
250+
<property name="minimumSize">
251+
<size>
252+
<width>0</width>
253+
<height>40</height>
254+
</size>
255+
</property>
256+
<property name="maximumSize">
257+
<size>
258+
<width>16777215</width>
259+
<height>90</height>
260+
</size>
261+
</property>
262+
<property name="baseSize">
263+
<size>
264+
<width>0</width>
265+
<height>40</height>
266+
</size>
267+
</property>
268+
<property name="autoFormatting">
269+
<set>QTextEdit::AutoBulletList</set>
270+
</property>
271+
<property name="readOnly">
272+
<bool>true</bool>
273+
</property>
274+
</widget>
275+
</item>
276+
</layout>
190277
</widget>
191278
</item>
192279
<item row="0" column="0">
193-
<layout class="QHBoxLayout" name="horizontalLayout">
194-
<item>
195-
<widget class="QLabel" name="label_5">
196-
<property name="text">
197-
<string>Filter</string>
198-
</property>
199-
</widget>
200-
</item>
201-
<item>
202-
<widget class="QgsFilterLineEdit" name="leSearch"/>
203-
</item>
204-
</layout>
205-
</item>
206-
<item row="1" column="0">
207-
<widget class="QLabel" name="label_3">
208-
<property name="font">
209-
<font>
210-
<weight>75</weight>
211-
<bold>true</bold>
212-
</font>
280+
<widget class="QCheckBox" name="mCheckBoxNoProjection">
281+
<property name="toolTip">
282+
<string>Use this option to treat all coordinates as cartesian coordinates in an unknown reference system.</string>
213283
</property>
214284
<property name="text">
215-
<string>Recently used coordinate reference systems</string>
216-
</property>
217-
</widget>
218-
</item>
219-
<item row="6" column="0">
220-
<widget class="QTextEdit" name="teProjection">
221-
<property name="minimumSize">
222-
<size>
223-
<width>0</width>
224-
<height>40</height>
225-
</size>
226-
</property>
227-
<property name="maximumSize">
228-
<size>
229-
<width>16777215</width>
230-
<height>90</height>
231-
</size>
232-
</property>
233-
<property name="baseSize">
234-
<size>
235-
<width>0</width>
236-
<height>40</height>
237-
</size>
238-
</property>
239-
<property name="autoFormatting">
240-
<set>QTextEdit::AutoBulletList</set>
241-
</property>
242-
<property name="readOnly">
243-
<bool>true</bool>
285+
<string>No projection (or unknown/non-Earth projection)</string>
244286
</property>
245287
</widget>
246288
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.