Skip to content

Commit ad32b5e

Browse files
committedOct 7, 2016
[BUGFIX][QGIS Server] Joins was not reloaded if the layer is in cache
With the commit f6aad8b, the QgsMapLayerRegistry signal `layersWillBeRemoved` is always emit. This imply that the vector layer join buffer is empty and not reloaded if the layer is in cache. To fix it, the layer XML element has to be read each time the layer is used. This commit fixed #15522 Qgis Server doesnt' respect the styling from Desktop
1 parent c653747 commit ad32b5e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/server/qgsserverprojectparser.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#include "qgseditorwidgetregistry.h"
2929
#include "qgslayertreegroup.h"
3030

31+
#include "qgslogger.h"
32+
#include "qgsmessagelog.h"
33+
3134
#include <QDomDocument>
3235
#include <QFileInfo>
3336
#include <QStringList>
@@ -234,8 +237,11 @@ QgsMapLayer* QgsServerProjectParser::createLayerFromElement( const QDomElement&
234237
if ( !QgsMapLayerRegistry::instance()->mapLayer( id ) )
235238
QgsMapLayerRegistry::instance()->addMapLayer( layer, false, false );
236239
if ( layer->type() == QgsMapLayer::VectorLayer )
240+
{
237241
addValueRelationLayersForLayer( dynamic_cast<QgsVectorLayer *>( layer ) );
238-
242+
// Reload joins and expression fields
243+
layer->readLayerXML( const_cast<QDomElement&>( elem ) );
244+
}
239245
return layer;
240246
}
241247

@@ -1535,7 +1541,7 @@ void QgsServerProjectParser::addJoinLayersForElement( const QDomElement& layerEl
15351541
{
15361542
QString id = joinNodeList.at( i ).toElement().attribute( "joinLayerId" );
15371543
QgsMapLayer* layer = mapLayerFromLayerId( id );
1538-
if ( layer )
1544+
if ( layer && !QgsMapLayerRegistry::instance()->mapLayer( id ))
15391545
{
15401546
QgsMapLayerRegistry::instance()->addMapLayer( layer, false, false );
15411547
}

0 commit comments

Comments
 (0)
Please sign in to comment.