Skip to content

Commit ab55325

Browse files
committedMar 27, 2013
refresh field names after all layers loaded and encoding change (fix #6840)
1 parent 3959f94 commit ab55325

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed
 

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ void QgsVectorLayerProperties::apply()
451451
{
452452
if ( layer->dataProvider()->capabilities() & QgsVectorDataProvider::SetEncoding )
453453
{
454-
layer->dataProvider()->setEncoding( cboProviderEncoding->currentText() );
454+
layer->setProviderEncoding( cboProviderEncoding->currentText() );
455455
}
456456
}
457457

‎src/core/qgsproject.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ QPair< bool, QList<QDomNode> > QgsProject::_getMapLayers( QDomDocument const &do
707707
for ( ; vIt != vLayerList.end(); ++vIt )
708708
{
709709
vIt->first->createJoinCaches();
710+
vIt->first->updateFields();
710711
//for old symbology, it is necessary to read the symbology again after having the complete field map
711712
if ( !vIt->first->isUsingRendererV2() )
712713
{

‎src/core/qgsvectorlayer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ void QgsVectorLayer::setProviderEncoding( const QString& encoding )
13211321
if ( mDataProvider )
13221322
{
13231323
mDataProvider->setEncoding( encoding );
1324+
updateFields();
13241325
}
13251326
}
13261327

@@ -3816,7 +3817,7 @@ void QgsVectorLayer::updateFields()
38163817
mEditBuffer->updateFields( mUpdatedFields );
38173818

38183819
// joined fields
3819-
if ( mJoinBuffer->containsJoins() )
3820+
if ( mJoinBuffer && mJoinBuffer->containsJoins() )
38203821
mJoinBuffer->updateFields( mUpdatedFields );
38213822
}
38223823

‎src/core/qgsvectorlayer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,10 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
813813
@note public and static from version 1.4 */
814814
static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
815815

816+
/** Assembles mUpdatedFields considering provider fields, joined fields and added fields
817+
@note added in 1.7 */
818+
void updateFields();
819+
816820
/** Caches joined attributes if required (and not already done)
817821
@note added in 1.7 */
818822
void createJoinCaches();
@@ -955,10 +959,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
955959
/** Stop version 2 renderer and selected renderer (if required) */
956960
void stopRendererV2( QgsRenderContext& rendererContext, QgsSingleSymbolRendererV2* selRenderer );
957961

958-
/** Assembles mUpdatedFields considering provider fields, joined fields and added fields
959-
@note added in 1.7 */
960-
void updateFields();
961-
962962
/**Registers label and diagram layer
963963
@param rendererContext render context
964964
@param attributes attributes needed for labeling and diagrams will be added to the list

0 commit comments

Comments
 (0)
Please sign in to comment.