@@ -230,7 +230,7 @@ bool eVisGenericEventBrowserGui::initBrowser()
230
230
// verify that the active layer is a vector layer
231
231
if ( QgsMapLayer::VectorLayer == mInterface ->activeLayer ()->type () )
232
232
{
233
- mVectorLayer = ( QgsVectorLayer * ) mInterface ->activeLayer ();
233
+ mVectorLayer = qobject_cast< QgsVectorLayer * >( mInterface ->activeLayer () );
234
234
mCanvas = mInterface ->mapCanvas ();
235
235
}
236
236
else
@@ -254,7 +254,7 @@ bool eVisGenericEventBrowserGui::initBrowser()
254
254
// verify that the active layer is a vector layer
255
255
if ( QgsMapLayer::VectorLayer == mCanvas ->currentLayer ()->type () )
256
256
{
257
- mVectorLayer = ( QgsVectorLayer * ) mCanvas ->currentLayer ();
257
+ mVectorLayer = qobject_cast< QgsVectorLayer * >( mCanvas ->currentLayer () );
258
258
}
259
259
else
260
260
{
@@ -305,7 +305,7 @@ bool eVisGenericEventBrowserGui::initBrowser()
305
305
return false ;
306
306
}
307
307
308
- QgsFields myFields = mDataProvider ->fields ();
308
+ QgsFields myFields = mVectorLayer ->fields ();
309
309
mIgnoreEvent = true ; // Ignore indexChanged event when adding items to combo boxes
310
310
for ( int x = 0 ; x < myFields.count (); x++ )
311
311
{
@@ -589,7 +589,7 @@ QgsFeature *eVisGenericEventBrowserGui::featureAtId( QgsFeatureId id )
589
589
{
590
590
// This method was originally necessary because delimited text data provider did not support featureAtId()
591
591
// It has mostly been stripped down now
592
- if ( mDataProvider && mFeatureIds .size () != 0 )
592
+ if ( mVectorLayer && mFeatureIds .size () != 0 )
593
593
{
594
594
if ( !mVectorLayer ->getFeatures ( QgsFeatureRequest ().setFilterFid ( id ) ).nextFeature ( mFeature ) )
595
595
{
@@ -617,7 +617,7 @@ void eVisGenericEventBrowserGui::loadRecord()
617
617
QString myCompassBearingField = cboxCompassBearingField->currentText ();
618
618
QString myCompassOffsetField = cboxCompassOffsetField->currentText ();
619
619
QString myEventImagePathField = cboxEventImagePathField->currentText ();
620
- QgsFields myFields = mDataProvider ->fields ();
620
+ QgsFields myFields = mVectorLayer ->fields ();
621
621
QgsAttributes myAttrs = myFeature->attributes ();
622
622
// loop through the attributes and display their contents
623
623
for ( int i = 0 ; i < myAttrs.count (); ++i )
@@ -859,7 +859,7 @@ void eVisGenericEventBrowserGui::cboxEventImagePathField_currentIndexChanged( in
859
859
{
860
860
mConfiguration .setEventImagePathField ( cboxEventImagePathField->currentText () );
861
861
862
- QgsFields myFields = mDataProvider ->fields ();
862
+ QgsFields myFields = mVectorLayer ->fields ();
863
863
QgsFeature *myFeature = featureAtId ( mFeatureIds .at ( mCurrentFeatureIndex ) );
864
864
865
865
if ( !myFeature )
@@ -887,7 +887,7 @@ void eVisGenericEventBrowserGui::cboxCompassBearingField_currentIndexChanged( in
887
887
{
888
888
mConfiguration .setCompassBearingField ( cboxCompassBearingField->currentText () );
889
889
890
- QgsFields myFields = mDataProvider ->fields ();
890
+ QgsFields myFields = mVectorLayer ->fields ();
891
891
QgsFeature *myFeature = featureAtId ( mFeatureIds .at ( mCurrentFeatureIndex ) );
892
892
893
893
if ( !myFeature )
@@ -915,7 +915,7 @@ void eVisGenericEventBrowserGui::cboxCompassOffsetField_currentIndexChanged( int
915
915
{
916
916
mConfiguration .setCompassOffsetField ( cboxCompassOffsetField->currentText () );
917
917
918
- QgsFields myFields = mDataProvider ->fields ();
918
+ QgsFields myFields = mVectorLayer ->fields ();
919
919
QgsFeature *myFeature = featureAtId ( mFeatureIds .at ( mCurrentFeatureIndex ) );
920
920
921
921
if ( !myFeature )
0 commit comments