Skip to content
Permalink
Browse files

Switch some dynamic_casts to qobject_casts

  • Loading branch information
nyalldawson committed Aug 31, 2017
1 parent e7ddfff commit ed5e4b69c720e901d5531cdf1de7f39814a20970
@@ -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();
}
@@ -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 );
@@ -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 )

0 comments on commit ed5e4b6

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