Skip to content

Commit

Permalink
refresh field names after all layers loaded and encoding change (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
minorua committed Mar 27, 2013
1 parent 3959f94 commit ab55325
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -451,7 +451,7 @@ void QgsVectorLayerProperties::apply()
{
if ( layer->dataProvider()->capabilities() & QgsVectorDataProvider::SetEncoding )
{
layer->dataProvider()->setEncoding( cboProviderEncoding->currentText() );
layer->setProviderEncoding( cboProviderEncoding->currentText() );
}
}

Expand Down
1 change: 1 addition & 0 deletions src/core/qgsproject.cpp
Expand Up @@ -707,6 +707,7 @@ QPair< bool, QList<QDomNode> > QgsProject::_getMapLayers( QDomDocument const &do
for ( ; vIt != vLayerList.end(); ++vIt )
{
vIt->first->createJoinCaches();
vIt->first->updateFields();
//for old symbology, it is necessary to read the symbology again after having the complete field map
if ( !vIt->first->isUsingRendererV2() )
{
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -1321,6 +1321,7 @@ void QgsVectorLayer::setProviderEncoding( const QString& encoding )
if ( mDataProvider )
{
mDataProvider->setEncoding( encoding );
updateFields();
}
}

Expand Down Expand Up @@ -3816,7 +3817,7 @@ void QgsVectorLayer::updateFields()
mEditBuffer->updateFields( mUpdatedFields );

// joined fields
if ( mJoinBuffer->containsJoins() )
if ( mJoinBuffer && mJoinBuffer->containsJoins() )
mJoinBuffer->updateFields( mUpdatedFields );
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/qgsvectorlayer.h
Expand Up @@ -813,6 +813,10 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
@note public and static from version 1.4 */
static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );

/** Assembles mUpdatedFields considering provider fields, joined fields and added fields
@note added in 1.7 */
void updateFields();

/** Caches joined attributes if required (and not already done)
@note added in 1.7 */
void createJoinCaches();
Expand Down Expand Up @@ -955,10 +959,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** Stop version 2 renderer and selected renderer (if required) */
void stopRendererV2( QgsRenderContext& rendererContext, QgsSingleSymbolRendererV2* selRenderer );

/** Assembles mUpdatedFields considering provider fields, joined fields and added fields
@note added in 1.7 */
void updateFields();

/**Registers label and diagram layer
@param rendererContext render context
@param attributes attributes needed for labeling and diagrams will be added to the list
Expand Down

0 comments on commit ab55325

Please sign in to comment.