Skip to content

Commit 92e3c05

Browse files
author
mhugent
committed
Fix side effect of last commit
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14368 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a643c6b commit 92e3c05

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/core/composer/qgscomposerattributetable.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ bool QgsComposerAttributeTableCompare::operator()( const QgsAttributeMap& m1, co
4646
QgsComposerAttributeTable::QgsComposerAttributeTable( QgsComposition* composition ): QgsComposerTable( composition ), mVectorLayer( 0 ), mComposerMap( 0 ), \
4747
mMaximumNumberOfFeatures( 5 ), mShowOnlyVisibleFeatures( true )
4848
{
49+
//set first vector layer from layer registry as default one
50+
QMap<QString, QgsMapLayer*> layerMap = QgsMapLayerRegistry::instance()->mapLayers();
51+
QMap<QString, QgsMapLayer*>::const_iterator mapIt = layerMap.constBegin();
52+
for ( ; mapIt != layerMap.constEnd(); ++mapIt )
53+
{
54+
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( mapIt.value() );
55+
if ( vl )
56+
{
57+
mVectorLayer = vl;
58+
break;
59+
}
60+
}
4961
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString& ) ) );
5062
}
5163

0 commit comments

Comments
 (0)