Skip to content

Commit 0ba9cbf

Browse files
author
timlinux
committed
Automatically sample on field calculator and gui tidy ups
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14665 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d373f12 commit 0ba9cbf

File tree

3 files changed

+98
-64
lines changed

3 files changed

+98
-64
lines changed

src/app/qgsfieldcalculator.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,6 @@ void QgsFieldCalculator::on_mConcatButton_clicked()
397397
mExpressionTextEdit->insertPlainText( "||" );
398398
}
399399

400-
void QgsFieldCalculator::on_mSamplePushButton_clicked()
401-
{
402-
getFieldValues( 25 );
403-
}
404-
405400
void QgsFieldCalculator::on_mAllPushButton_clicked()
406401
{
407402
getFieldValues( 0 );
@@ -504,3 +499,7 @@ void QgsFieldCalculator::setOkButtonState()
504499
}
505500

506501

502+
void QgsFieldCalculator::on_mFieldsListWidget_currentItemChanged(QListWidgetItem * current, QListWidgetItem * previous )
503+
{
504+
getFieldValues( 25 );
505+
}

src/app/qgsfieldcalculator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class QgsFieldCalculator: public QDialog, private Ui::QgsFieldCalculatorBase
5656
void on_mAreaButton_clicked();
5757
void on_mRowNumButton_clicked();
5858
void on_mConcatButton_clicked();
59-
void on_mSamplePushButton_clicked();
6059
void on_mAllPushButton_clicked();
6160
void on_mOutputFieldNameLineEdit_textChanged( const QString& text );
6261
void on_mExpressionTextEdit_textChanged();
6362
void on_mOutputFieldTypeComboBox_activated( int index );
63+
void on_mFieldsListWidget_currentItemChanged(QListWidgetItem * current, QListWidgetItem * previous );
6464

6565
void on_mButtonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
6666

src/ui/qgsfieldcalculatorbase.ui

Lines changed: 93 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,40 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>624</width>
10-
<height>686</height>
9+
<width>689</width>
10+
<height>569</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
1414
<string>Field calculator</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout_2">
1717
<item row="0" column="0">
18-
<widget class="QCheckBox" name="mUpdateExistingFieldCheckBox">
18+
<widget class="QCheckBox" name="mOnlyUpdateSelectedCheckBox">
1919
<property name="text">
20-
<string>Update existing field</string>
20+
<string>Only update selected features</string>
2121
</property>
2222
</widget>
2323
</item>
2424
<item row="0" column="1">
25-
<widget class="QComboBox" name="mExistingFieldComboBox"/>
26-
</item>
27-
<item row="1" column="0" colspan="2">
28-
<widget class="QCheckBox" name="mOnlyUpdateSelectedCheckBox">
25+
<widget class="QCheckBox" name="mUpdateExistingFieldCheckBox">
2926
<property name="text">
30-
<string>Only update selected features</string>
27+
<string>Update existing field</string>
3128
</property>
3229
</widget>
3330
</item>
34-
<item row="2" column="0" colspan="3">
31+
<item row="0" column="2">
32+
<widget class="QComboBox" name="mExistingFieldComboBox"/>
33+
</item>
34+
<item row="1" column="0" colspan="3">
3535
<widget class="QGroupBox" name="mNewFieldGroupBox">
3636
<property name="title">
3737
<string>New field</string>
3838
</property>
3939
<layout class="QGridLayout">
40+
<property name="bottomMargin">
41+
<number>0</number>
42+
</property>
4043
<item row="0" column="0">
4144
<widget class="QLabel" name="mFieldNameLabel">
4245
<property name="text">
@@ -74,56 +77,32 @@
7477
</widget>
7578
</item>
7679
<item row="2" column="1">
77-
<widget class="QSpinBox" name="mOuputFieldWidthSpinBox"/>
80+
<widget class="QSpinBox" name="mOuputFieldWidthSpinBox">
81+
<property name="toolTip">
82+
<string>Width of complete output. For example 123,456 means 6 as field width.</string>
83+
</property>
84+
<property name="minimum">
85+
<number>0</number>
86+
</property>
87+
<property name="value">
88+
<number>5</number>
89+
</property>
90+
</widget>
7891
</item>
7992
<item row="2" column="2">
8093
<widget class="QLabel" name="mOutputFieldPrecisionLabel">
8194
<property name="text">
82-
<string>Output field precision</string>
95+
<string>Precision</string>
8396
</property>
8497
<property name="buddy">
8598
<cstring>mOutputFieldPrecisionSpinBox</cstring>
8699
</property>
87100
</widget>
88101
</item>
89102
<item row="2" column="3">
90-
<widget class="QSpinBox" name="mOutputFieldPrecisionSpinBox"/>
91-
</item>
92-
</layout>
93-
</widget>
94-
</item>
95-
<item row="3" column="0" colspan="2">
96-
<widget class="QGroupBox" name="mFieldsGroupBox">
97-
<property name="title">
98-
<string>Fields</string>
99-
</property>
100-
<layout class="QGridLayout">
101-
<item row="0" column="0">
102-
<widget class="QListWidget" name="mFieldsListWidget"/>
103-
</item>
104-
</layout>
105-
</widget>
106-
</item>
107-
<item row="3" column="2">
108-
<widget class="QGroupBox" name="mValuesGroupBox">
109-
<property name="title">
110-
<string>Values</string>
111-
</property>
112-
<layout class="QGridLayout">
113-
<item row="0" column="0" colspan="2">
114-
<widget class="QListWidget" name="mValueListWidget"/>
115-
</item>
116-
<item row="1" column="0">
117-
<widget class="QPushButton" name="mSamplePushButton">
118-
<property name="text">
119-
<string>Sample</string>
120-
</property>
121-
</widget>
122-
</item>
123-
<item row="1" column="1">
124-
<widget class="QPushButton" name="mAllPushButton">
125-
<property name="text">
126-
<string>All</string>
103+
<widget class="QSpinBox" name="mOutputFieldPrecisionSpinBox">
104+
<property name="value">
105+
<number>2</number>
127106
</property>
128107
</widget>
129108
</item>
@@ -136,6 +115,12 @@
136115
<string>Operators</string>
137116
</property>
138117
<layout class="QGridLayout" name="gridLayout_1">
118+
<property name="topMargin">
119+
<number>5</number>
120+
</property>
121+
<property name="bottomMargin">
122+
<number>5</number>
123+
</property>
139124
<item row="0" column="0">
140125
<widget class="QPushButton" name="mPlusPushButton">
141126
<property name="text">
@@ -309,19 +294,69 @@
309294
</property>
310295
</widget>
311296
</item>
297+
<item row="3" column="0" colspan="3">
298+
<widget class="QFrame" name="frame">
299+
<layout class="QGridLayout" name="gridLayout">
300+
<item row="1" column="1" rowspan="2" colspan="2">
301+
<widget class="QFrame" name="mValuesFrame">
302+
<layout class="QGridLayout">
303+
<property name="leftMargin">
304+
<number>9</number>
305+
</property>
306+
<property name="topMargin">
307+
<number>0</number>
308+
</property>
309+
<property name="bottomMargin">
310+
<number>6</number>
311+
</property>
312+
<item row="2" column="2">
313+
<widget class="QPushButton" name="mAllPushButton">
314+
<property name="text">
315+
<string>All</string>
316+
</property>
317+
</widget>
318+
</item>
319+
<item row="0" column="1" rowspan="3">
320+
<widget class="QListWidget" name="mValueListWidget"/>
321+
</item>
322+
</layout>
323+
</widget>
324+
</item>
325+
<item row="1" column="0">
326+
<widget class="QListWidget" name="mFieldsListWidget"/>
327+
</item>
328+
<item row="0" column="0">
329+
<widget class="QLabel" name="label">
330+
<property name="text">
331+
<string>Fields</string>
332+
</property>
333+
<property name="textFormat">
334+
<enum>Qt::AutoText</enum>
335+
</property>
336+
</widget>
337+
</item>
338+
<item row="0" column="1">
339+
<widget class="QLabel" name="label_2">
340+
<property name="text">
341+
<string>Values</string>
342+
</property>
343+
</widget>
344+
</item>
345+
</layout>
346+
<zorder>mValuesFrame</zorder>
347+
<zorder>mFieldsListWidget</zorder>
348+
<zorder>label</zorder>
349+
<zorder>label_2</zorder>
350+
</widget>
351+
</item>
312352
</layout>
313353
</widget>
314354
<tabstops>
315-
<tabstop>mUpdateExistingFieldCheckBox</tabstop>
316-
<tabstop>mExistingFieldComboBox</tabstop>
317-
<tabstop>mOnlyUpdateSelectedCheckBox</tabstop>
318355
<tabstop>mOutputFieldNameLineEdit</tabstop>
319356
<tabstop>mOutputFieldTypeComboBox</tabstop>
320357
<tabstop>mOuputFieldWidthSpinBox</tabstop>
321358
<tabstop>mOutputFieldPrecisionSpinBox</tabstop>
322-
<tabstop>mFieldsListWidget</tabstop>
323359
<tabstop>mValueListWidget</tabstop>
324-
<tabstop>mSamplePushButton</tabstop>
325360
<tabstop>mAllPushButton</tabstop>
326361
<tabstop>mPlusPushButton</tabstop>
327362
<tabstop>mMultiplyPushButton</tabstop>
@@ -355,8 +390,8 @@
355390
<slot>accept()</slot>
356391
<hints>
357392
<hint type="sourcelabel">
358-
<x>321</x>
359-
<y>676</y>
393+
<x>679</x>
394+
<y>559</y>
360395
</hint>
361396
<hint type="destinationlabel">
362397
<x>157</x>
@@ -371,8 +406,8 @@
371406
<slot>reject()</slot>
372407
<hints>
373408
<hint type="sourcelabel">
374-
<x>321</x>
375-
<y>676</y>
409+
<x>679</x>
410+
<y>559</y>
376411
</hint>
377412
<hint type="destinationlabel">
378413
<x>286</x>

0 commit comments

Comments
 (0)