Skip to content
Permalink
Browse files

Use qobject_cast

  • Loading branch information
nyalldawson committed Dec 28, 2018
1 parent 1b309c6 commit 97daa5080d95e48c59a415dbde05c5520dac942a
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/core/layout/qgslayoutitemmapoverview.cpp
@@ -401,19 +401,19 @@ void QgsLayoutItemMapOverviewStack::moveOverviewDown( const QString &overviewId
QgsLayoutItemMapOverview *QgsLayoutItemMapOverviewStack::overview( const QString &overviewId ) const
{
QgsLayoutItemMapItem *item = QgsLayoutItemMapItemStack::item( overviewId );
return dynamic_cast<QgsLayoutItemMapOverview *>( item );
return qobject_cast<QgsLayoutItemMapOverview *>( item );
}

QgsLayoutItemMapOverview *QgsLayoutItemMapOverviewStack::overview( const int index ) const
{
QgsLayoutItemMapItem *item = QgsLayoutItemMapItemStack::item( index );
return dynamic_cast<QgsLayoutItemMapOverview *>( item );
return qobject_cast<QgsLayoutItemMapOverview *>( item );
}

QgsLayoutItemMapOverview &QgsLayoutItemMapOverviewStack::operator[]( int idx )
{
QgsLayoutItemMapItem *item = mItems.at( idx );
QgsLayoutItemMapOverview *overview = dynamic_cast<QgsLayoutItemMapOverview *>( item );
QgsLayoutItemMapOverview *overview = qobject_cast<QgsLayoutItemMapOverview *>( item );
return *overview;
}

@@ -423,7 +423,7 @@ QList<QgsLayoutItemMapOverview *> QgsLayoutItemMapOverviewStack::asList() const
QList< QgsLayoutItemMapItem * >::const_iterator it = mItems.begin();
for ( ; it != mItems.end(); ++it )
{
QgsLayoutItemMapOverview *overview = dynamic_cast<QgsLayoutItemMapOverview *>( *it );
QgsLayoutItemMapOverview *overview = qobject_cast<QgsLayoutItemMapOverview *>( *it );
if ( overview )
{
list.append( overview );

0 comments on commit 97daa50

Please sign in to comment.
You can’t perform that action at this time.