Skip to content

Commit ed5e4b6

Browse files
committedAug 31, 2017
Switch some dynamic_casts to qobject_casts
1 parent e7ddfff commit ed5e4b6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed
 

‎src/app/qgsdxfexportdialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void FieldSelectorDelegate::setEditorData( QWidget *editor, const QModelIndex &i
7979

8080
void FieldSelectorDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
8181
{
82-
QgsVectorLayerAndAttributeModel *m = dynamic_cast< QgsVectorLayerAndAttributeModel *>( model );
82+
QgsVectorLayerAndAttributeModel *m = qobject_cast< QgsVectorLayerAndAttributeModel *>( model );
8383
if ( !m )
8484
return;
8585

@@ -492,7 +492,7 @@ QgsDxfExportDialog::~QgsDxfExportDialog()
492492
void QgsDxfExportDialog::on_mVisibilityPresets_currentIndexChanged( int index )
493493
{
494494
Q_UNUSED( index );
495-
QgsVectorLayerAndAttributeModel *model = dynamic_cast< QgsVectorLayerAndAttributeModel * >( mTreeView->model() );
495+
QgsVectorLayerAndAttributeModel *model = qobject_cast< QgsVectorLayerAndAttributeModel * >( mTreeView->model() );
496496
Q_ASSERT( model );
497497
model->applyVisibilityPreset( mVisibilityPresets->currentText() );
498498
}
@@ -525,14 +525,14 @@ void QgsDxfExportDialog::cleanGroup( QgsLayerTreeNode *node )
525525

526526
void QgsDxfExportDialog::selectAll()
527527
{
528-
QgsVectorLayerAndAttributeModel *model = dynamic_cast< QgsVectorLayerAndAttributeModel *>( mTreeView->model() );
528+
QgsVectorLayerAndAttributeModel *model = qobject_cast< QgsVectorLayerAndAttributeModel *>( mTreeView->model() );
529529
Q_ASSERT( model );
530530
model->selectAll();
531531
}
532532

533533
void QgsDxfExportDialog::deSelectAll()
534534
{
535-
QgsVectorLayerAndAttributeModel *model = dynamic_cast< QgsVectorLayerAndAttributeModel *>( mTreeView->model() );
535+
QgsVectorLayerAndAttributeModel *model = qobject_cast< QgsVectorLayerAndAttributeModel *>( mTreeView->model() );
536536
Q_ASSERT( model );
537537
model->deSelectAll();
538538
}

‎src/app/qgsstatisticalsummarydockwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void QgsStatisticalSummaryDockWidget::updateStringStatistics( bool selectedOnly
241241

242242
void QgsStatisticalSummaryDockWidget::layerChanged( QgsMapLayer *layer )
243243
{
244-
QgsVectorLayer *newLayer = dynamic_cast< QgsVectorLayer * >( layer );
244+
QgsVectorLayer *newLayer = qobject_cast< QgsVectorLayer * >( layer );
245245
if ( mLayer && mLayer != newLayer )
246246
{
247247
disconnect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsStatisticalSummaryDockWidget::layerSelectionChanged );

‎src/core/expression/qgsexpressionfunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3455,7 +3455,7 @@ static QVariant fcnGetLayerProperty( const QVariantList &values, const QgsExpres
34553455
else
34563456
{
34573457
//vector layer methods
3458-
QgsVectorLayer *vLayer = dynamic_cast< QgsVectorLayer * >( layer );
3458+
QgsVectorLayer *vLayer = qobject_cast< QgsVectorLayer * >( layer );
34593459
if ( vLayer )
34603460
{
34613461
if ( QString::compare( layerProperty, QStringLiteral( "storage_type" ), Qt::CaseInsensitive ) == 0 )

0 commit comments

Comments
 (0)
Please sign in to comment.