Skip to content

Commit 9b93f9b

Browse files
committed
Merge branch 'master' into expression-builder-highlighter
2 parents de48504 + 3c9d1a3 commit 9b93f9b

File tree

10 files changed

+1859
-1596
lines changed

10 files changed

+1859
-1596
lines changed

i18n/qgis_et.ts

Lines changed: 1566 additions & 1347 deletions
Large diffs are not rendered by default.

src/app/legend/qgslegend.cpp

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,17 @@ int QgsLegend::addGroup( QString name, bool expand, QTreeWidgetItem* parent )
169169
QgsLegendGroup *group;
170170

171171
if ( parentGroup )
172+
{
172173
group = new QgsLegendGroup( parentGroup, name );
174+
}
173175
else
176+
{
174177
group = new QgsLegendGroup( this, name );
178+
if ( currentItem() )
179+
{
180+
moveItem( group, currentItem() );
181+
}
182+
}
175183

176184
QModelIndex groupIndex = indexFromItem( group );
177185
setExpanded( groupIndex, expand );
@@ -808,19 +816,34 @@ void QgsLegend::addLayer( QgsMapLayer * layer )
808816
blockSignals( false );
809817

810818
QgsLegendGroup *lg = dynamic_cast<QgsLegendGroup *>( currentItem() );
811-
QSettings settings;
812819
if ( !lg && currentItem() )
813820
{
814821
lg = dynamic_cast<QgsLegendGroup *>( currentItem()->parent() );
815822
}
816823

824+
int index;
825+
if ( lg )
826+
{
827+
index = lg->indexOfChild( currentItem() );
828+
}
829+
else
830+
{
831+
index = indexOfTopLevelItem( currentItem() );
832+
}
833+
834+
if ( index < 0 )
835+
{
836+
index = 0;
837+
}
838+
839+
QSettings settings;
817840
if ( lg && settings.value( "/qgis/addNewLayersToCurrentGroup", false ).toBool() )
818841
{
819-
lg->insertChild( 0, llayer );
842+
lg->insertChild( index, llayer );
820843
}
821844
else
822845
{
823-
insertTopLevelItem( 0, llayer );
846+
insertTopLevelItem( index, llayer );
824847
setCurrentItem( llayer );
825848
}
826849

src/app/qgsaddattrdialog.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@
2020
#include "qgsvectordataprovider.h"
2121
#include "qgslogger.h"
2222

23+
#include <QMessageBox>
24+
2325
QgsAddAttrDialog::QgsAddAttrDialog( QgsVectorLayer *vlayer, QWidget *parent, Qt::WFlags fl )
2426
: QDialog( parent, fl )
2527
{
2628
setupUi( this );
2729

2830
//fill data types into the combo box
2931
const QList< QgsVectorDataProvider::NativeType > &typelist = vlayer->dataProvider()->nativeTypes();
32+
mLayerType = vlayer->storageType();
3033

3134
for ( int i = 0; i < typelist.size(); i++ )
3235
{
@@ -70,6 +73,17 @@ void QgsAddAttrDialog::on_mTypeBox_currentIndexChanged( int idx )
7073
mPrec->setValue( mPrec->maximum() );
7174
}
7275

76+
void QgsAddAttrDialog::accept()
77+
{
78+
if ( mLayerType == "ESRI Shapefile" && mNameEdit->text().toLower() == "shape" )
79+
{
80+
QMessageBox::warning( this, tr( "Warning" ),
81+
tr( "Invalid field name. This field name is reserved and cannot be used." ) );
82+
return;
83+
}
84+
QDialog::accept();
85+
}
86+
7387
QgsField QgsAddAttrDialog::field() const
7488
{
7589
QgsDebugMsg( QString( "idx:%1 name:%2 type:%3 typeName:%4 length:%5 prec:%6 comment:%7" )

src/app/qgsaddattrdialog.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogBase
3737

3838
public slots:
3939
void on_mTypeBox_currentIndexChanged( int idx );
40+
void accept();
41+
42+
private:
43+
QString mLayerType;
4044

4145
};
4246

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,15 +455,18 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
455455

456456
if ( myRecord.empty() )
457457
{
458-
// match all arameters individually:
458+
// match all parameters individually:
459459
// - order of parameters doesn't matter
460460
// - found definition may have more parameters (like +towgs84 in GDAL)
461461
// - retry without datum, if no match is found (looks like +datum<>WGS84 was dropped in GDAL)
462462

463463
QString sql = "SELECT * FROM tbl_srs WHERE ";
464464
QString delim = "";
465465
QString datum;
466-
foreach( QString param, theProj4String.split( " ", QString::SkipEmptyParts ) )
466+
467+
// split on spaces followed by a plus sign (+) to deal
468+
// also with parameters containing spaces (e.g. +nadgrids)
469+
foreach( QString param, theProj4String.split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
467470
{
468471
QString arg = QString( "' '||parameters||' ' LIKE %1" ).arg( quotedValue( QString( "% %1 %" ).arg( param ) ) );
469472
if ( param.startsWith( "+datum=" ) )

src/gui/qgsexpressionbuilderwidget.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,11 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )
4242

4343
expressionTree->setContextMenuPolicy( Qt::CustomContextMenu );
4444
connect( expressionTree, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) );
45-
connect( btnPlusPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
46-
connect( btnMinusPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
47-
connect( btnDividePushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
48-
connect( btnMultiplyPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
49-
connect( btnExpButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
50-
connect( btnConcatButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
51-
connect( btnOpenBracketPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
52-
connect( btnCloseBracketPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
5345

46+
foreach (QPushButton* button, this->mOperatorsGroupBox->findChildren<QPushButton *>())
47+
{
48+
connect( button, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
49+
}
5450

5551
// TODO Can we move this stuff to QgsExpression, like the functions?
5652
registerItem( tr( "Operators" ), "+", " + " );

src/ui/qgsexpressionbuilder.ui

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@
283283
<property name="bottomMargin">
284284
<number>0</number>
285285
</property>
286+
<item>
287+
<widget class="QPushButton" name="btnEqualPushButton">
288+
<property name="text">
289+
<string>=</string>
290+
</property>
291+
</widget>
292+
</item>
286293
<item>
287294
<widget class="QPushButton" name="btnPlusPushButton">
288295
<property name="sizePolicy">

tests/testdata/lines.qml

Lines changed: 71 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,73 @@
11
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
2-
<qgis version="0.9.2-Ganymede" minimumScale="1" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0" geometry="Line" type="vector" >
3-
<id>lines20080110101725388</id>
4-
<datasource>/Users/timlinux/dev/cpp/qgis_qml/tests/testdata/lines.shp</datasource>
5-
<layername>lines</layername>
6-
<srs>
7-
<spatialrefsys>
8-
<proj4>+proj=longlat +ellps=WGS84 +no_defs</proj4>
9-
<srsid>1449</srsid>
10-
<srid>4031</srid>
11-
<epsg>4031</epsg>
12-
<description>Unknown datum based upon the GEM 10C ellipsoid</description>
13-
<projectionacronym>longlat</projectionacronym>
14-
<ellipsoidacronym>WGS84</ellipsoidacronym>
15-
<geographicflag>true</geographicflag>
16-
</spatialrefsys>
17-
</srs>
18-
<transparencyLevelInt>255</transparencyLevelInt>
19-
<provider>ogr</provider>
20-
<encoding>System</encoding>
21-
<classificationattribute>Name</classificationattribute>
22-
<displayfield>Name</displayfield>
23-
<label>0</label>
24-
<attributeactions/>
25-
<uniquevalue>
26-
<classificationfield>0</classificationfield>
27-
<symbol>
28-
<lowervalue>Arterial</lowervalue>
29-
<uppervalue></uppervalue>
30-
<label></label>
31-
<pointsymbol>hard:circle</pointsymbol>
32-
<pointsize>11</pointsize>
33-
<rotationclassificationfield>-1</rotationclassificationfield>
34-
<scaleclassificationfield>-1</scaleclassificationfield>
35-
<outlinecolor red="154" blue="116" green="139" />
36-
<outlinestyle>DashDotDotLine</outlinestyle>
37-
<outlinewidth>5</outlinewidth>
38-
<fillcolor red="0" blue="0" green="0" />
39-
<fillpattern>NoBrush</fillpattern>
40-
<texturepath></texturepath>
41-
</symbol>
42-
<symbol>
43-
<lowervalue>Highway</lowervalue>
44-
<uppervalue></uppervalue>
45-
<label></label>
46-
<pointsymbol>hard:circle</pointsymbol>
47-
<pointsize>11</pointsize>
48-
<rotationclassificationfield>-1</rotationclassificationfield>
49-
<scaleclassificationfield>-1</scaleclassificationfield>
50-
<outlinecolor red="94" blue="55" green="89" />
51-
<outlinestyle>SolidLine</outlinestyle>
52-
<outlinewidth>7</outlinewidth>
53-
<fillcolor red="0" blue="0" green="0" />
54-
<fillpattern>NoBrush</fillpattern>
55-
<texturepath></texturepath>
56-
</symbol>
57-
</uniquevalue>
58-
<labelattributes>
59-
<label field="" text="Label" />
60-
<family field="" name="Lucida Grande" />
61-
<size field="" units="pt" value="12" />
62-
<bold field="" on="0" />
63-
<italic field="" on="0" />
64-
<underline field="" on="0" />
65-
<color field="" red="0" blue="0" green="0" />
66-
<x field="" />
67-
<y field="" />
68-
<offset x="0" y="0" yfield="-1" xfield="-1" units="pt" />
69-
<angle field="" value="0" />
70-
<alignment field="-1" value="center" />
71-
<buffercolor field="" red="255" blue="255" green="255" />
72-
<buffersize field="" units="pt" value="1" />
73-
<bufferenabled field="" on="" />
74-
</labelattributes>
2+
<qgis version="1.9.90-Alpha" minimumScale="1" maximumScale="1e+08" minLabelScale="1" maxLabelScale="1e+08" hasScaleBasedVisibilityFlag="0" scaleBasedLabelVisibilityFlag="0">
3+
<transparencyLevelInt>255</transparencyLevelInt>
4+
<classificationattribute>Name</classificationattribute>
5+
<uniquevalue>
6+
<classificationfield>Name</classificationfield>
7+
<symbol>
8+
<lowervalue>Arterial</lowervalue>
9+
<uppervalue></uppervalue>
10+
<label></label>
11+
<pointsymbol>hard:circle</pointsymbol>
12+
<pointsize>11</pointsize>
13+
<pointsizeunits>pixels</pointsizeunits>
14+
<rotationclassificationfieldname></rotationclassificationfieldname>
15+
<scaleclassificationfieldname></scaleclassificationfieldname>
16+
<symbolfieldname></symbolfieldname>
17+
<outlinecolor red="154" blue="116" green="139"/>
18+
<outlinestyle>DashDotDotLine</outlinestyle>
19+
<outlinewidth>5</outlinewidth>
20+
<fillcolor red="0" blue="0" green="0"/>
21+
<fillpattern>NoBrush</fillpattern>
22+
<texturepath></texturepath>
23+
</symbol>
24+
<symbol>
25+
<lowervalue>Highway</lowervalue>
26+
<uppervalue></uppervalue>
27+
<label></label>
28+
<pointsymbol>hard:circle</pointsymbol>
29+
<pointsize>11</pointsize>
30+
<pointsizeunits>pixels</pointsizeunits>
31+
<rotationclassificationfieldname></rotationclassificationfieldname>
32+
<scaleclassificationfieldname></scaleclassificationfieldname>
33+
<symbolfieldname></symbolfieldname>
34+
<outlinecolor red="94" blue="55" green="89"/>
35+
<outlinestyle>SolidLine</outlinestyle>
36+
<outlinewidth>7</outlinewidth>
37+
<fillcolor red="0" blue="0" green="0"/>
38+
<fillpattern>NoBrush</fillpattern>
39+
<texturepath></texturepath>
40+
</symbol>
41+
</uniquevalue>
42+
<customproperties/>
43+
<displayfield>Name</displayfield>
44+
<label>0</label>
45+
<labelattributes>
46+
<label fieldname="" text="Label"/>
47+
<family fieldname="" name="Lucida Grande"/>
48+
<size fieldname="" units="pt" value="12"/>
49+
<bold fieldname="" on="0"/>
50+
<italic fieldname="" on="0"/>
51+
<underline fieldname="" on="0"/>
52+
<strikeout fieldname="" on="0"/>
53+
<color fieldname="" red="0" blue="0" green="0"/>
54+
<x fieldname=""/>
55+
<y fieldname=""/>
56+
<offset x="0" y="0" units="pt" yfieldname="" xfieldname=""/>
57+
<angle fieldname="" value="0" auto="0"/>
58+
<alignment fieldname="" value="center"/>
59+
<buffercolor fieldname="" red="255" blue="255" green="255"/>
60+
<buffersize fieldname="" units="pt" value="1"/>
61+
<bufferenabled fieldname="" on=""/>
62+
<multilineenabled fieldname="" on=""/>
63+
<selectedonly on=""/>
64+
</labelattributes>
65+
<edittypes>
66+
<edittype type="0" name="Name"/>
67+
<edittype type="0" name="Value"/>
68+
</edittypes>
69+
<editform></editform>
70+
<editforminit></editforminit>
71+
<annotationform></annotationform>
72+
<attributeactions/>
7573
</qgis>

0 commit comments

Comments
 (0)