Switch some dynamic_casts to qobject_casts

This commit is contained in:
Nyall Dawson 2017-09-01 07:56:22 +10:00
parent e7ddfff09d
commit ed5e4b69c7
3 changed files with 6 additions and 6 deletions

View File

@ -79,7 +79,7 @@ void FieldSelectorDelegate::setEditorData( QWidget *editor, const QModelIndex &i
void FieldSelectorDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
{
QgsVectorLayerAndAttributeModel *m = dynamic_cast< QgsVectorLayerAndAttributeModel *>( model );
QgsVectorLayerAndAttributeModel *m = qobject_cast< QgsVectorLayerAndAttributeModel *>( model );
if ( !m )
return;
@ -492,7 +492,7 @@ QgsDxfExportDialog::~QgsDxfExportDialog()
void QgsDxfExportDialog::on_mVisibilityPresets_currentIndexChanged( int index )
{
Q_UNUSED( index );
QgsVectorLayerAndAttributeModel *model = dynamic_cast< QgsVectorLayerAndAttributeModel * >( mTreeView->model() );
QgsVectorLayerAndAttributeModel *model = qobject_cast< QgsVectorLayerAndAttributeModel * >( mTreeView->model() );
Q_ASSERT( model );
model->applyVisibilityPreset( mVisibilityPresets->currentText() );
}
@ -525,14 +525,14 @@ void QgsDxfExportDialog::cleanGroup( QgsLayerTreeNode *node )
void QgsDxfExportDialog::selectAll()
{
QgsVectorLayerAndAttributeModel *model = dynamic_cast< QgsVectorLayerAndAttributeModel *>( mTreeView->model() );
QgsVectorLayerAndAttributeModel *model = qobject_cast< QgsVectorLayerAndAttributeModel *>( mTreeView->model() );
Q_ASSERT( model );
model->selectAll();
}
void QgsDxfExportDialog::deSelectAll()
{
QgsVectorLayerAndAttributeModel *model = dynamic_cast< QgsVectorLayerAndAttributeModel *>( mTreeView->model() );
QgsVectorLayerAndAttributeModel *model = qobject_cast< QgsVectorLayerAndAttributeModel *>( mTreeView->model() );
Q_ASSERT( model );
model->deSelectAll();
}

View File

@ -241,7 +241,7 @@ void QgsStatisticalSummaryDockWidget::updateStringStatistics( bool selectedOnly
void QgsStatisticalSummaryDockWidget::layerChanged( QgsMapLayer *layer )
{
QgsVectorLayer *newLayer = dynamic_cast< QgsVectorLayer * >( layer );
QgsVectorLayer *newLayer = qobject_cast< QgsVectorLayer * >( layer );
if ( mLayer && mLayer != newLayer )
{
disconnect( mLayer, &QgsVectorLayer::selectionChanged, this, &QgsStatisticalSummaryDockWidget::layerSelectionChanged );

View File

@ -3455,7 +3455,7 @@ static QVariant fcnGetLayerProperty( const QVariantList &values, const QgsExpres
else
{
//vector layer methods
QgsVectorLayer *vLayer = dynamic_cast< QgsVectorLayer * >( layer );
QgsVectorLayer *vLayer = qobject_cast< QgsVectorLayer * >( layer );
if ( vLayer )
{
if ( QString::compare( layerProperty, QStringLiteral( "storage_type" ), Qt::CaseInsensitive ) == 0 )