@@ -503,19 +503,19 @@ QgsComposition* QgsWMSProjectParser::initComposition( const QString& composerTem
503503 QList<QgsComposerItem *>::iterator itemIt = itemList.begin ();
504504 for ( ; itemIt != itemList.end (); ++itemIt )
505505 {
506- QgsComposerLabel* label = dynamic_cast < QgsComposerLabel *>( *itemIt );
506+ QgsComposerLabel* label = qobject_cast < QgsComposerLabel *>( *itemIt );
507507 if ( label )
508508 {
509509 labelList.push_back ( label );
510510 continue ;
511511 }
512- QgsComposerMap* map = dynamic_cast < QgsComposerMap *>( *itemIt );
512+ QgsComposerMap* map = qobject_cast < QgsComposerMap *>( *itemIt );
513513 if ( map )
514514 {
515515 mapList.push_back ( map );
516516 continue ;
517517 }
518- QgsComposerLegend* legend = dynamic_cast < QgsComposerLegend *>( *itemIt );
518+ QgsComposerLegend* legend = qobject_cast < QgsComposerLegend *>( *itemIt );
519519 if ( legend )
520520 {
521521 QgsLegendModelV2* model = legend->modelV2 ();
@@ -567,7 +567,7 @@ QgsComposition* QgsWMSProjectParser::initComposition( const QString& composerTem
567567 legendList.push_back ( legend );
568568 continue ;
569569 }
570- QgsComposerPicture* pic = dynamic_cast < QgsComposerPicture *>( *itemIt );
570+ QgsComposerPicture* pic = qobject_cast < QgsComposerPicture *>( *itemIt );
571571 if ( pic )
572572 {
573573 pic->setPicturePath ( mProjectParser ->convertToAbsolutePath (( pic )->picturePath () ) );
@@ -576,11 +576,11 @@ QgsComposition* QgsWMSProjectParser::initComposition( const QString& composerTem
576576
577577 // an html item will be a composer frame and if it is we can try to get
578578 // its multiframe parent and then try to cast that to a composer html
579- const QgsComposerFrame* frame = dynamic_cast <const QgsComposerFrame *>( *itemIt );
579+ const QgsComposerFrame* frame = qobject_cast <const QgsComposerFrame *>( *itemIt );
580580 if ( frame )
581581 {
582582 const QgsComposerMultiFrame * multiFrame = frame->multiFrame ();
583- const QgsComposerHtml* composerHtml = dynamic_cast <const QgsComposerHtml *>( multiFrame );
583+ const QgsComposerHtml* composerHtml = qobject_cast <const QgsComposerHtml *>( multiFrame );
584584 if ( composerHtml )
585585 {
586586 htmlList.push_back ( composerHtml );
@@ -1332,7 +1332,7 @@ void QgsWMSProjectParser::addLayers( QDomDocument &doc,
13321332 bool geometryLayer = true ;
13331333 if ( currentLayer->type () == QgsMapLayer::VectorLayer )
13341334 {
1335- QgsVectorLayer* vLayer = dynamic_cast <QgsVectorLayer*>( currentLayer );
1335+ QgsVectorLayer* vLayer = qobject_cast <QgsVectorLayer*>( currentLayer );
13361336 if ( vLayer )
13371337 {
13381338 if ( vLayer->wkbType () == QGis::WKBNoGeometry )
@@ -1841,7 +1841,7 @@ QDomDocument QgsWMSProjectParser::getStyles( QStringList& layerList ) const
18411841 for ( int j = 0 ; j < currentLayerList.size (); j++ )
18421842 {
18431843 QgsMapLayer* currentLayer = currentLayerList.at ( j );
1844- QgsVectorLayer* layer = dynamic_cast <QgsVectorLayer*>( currentLayer );
1844+ QgsVectorLayer* layer = qobject_cast <QgsVectorLayer*>( currentLayer );
18451845 if ( !layer )
18461846 {
18471847 throw QgsMapServiceException ( " Error" , QString ( " Could not get style because:\n %1" ).arg ( " Non-vector layers not supported yet" ) );
0 commit comments