@@ -170,7 +170,7 @@ QComboBox *QgsMergeAttributesDialog::createMergeComboBox( QVariant::Type columnT
170
170
QgsFeatureList::const_iterator f_it = mFeatureList .constBegin ();
171
171
for ( ; f_it != mFeatureList .constEnd (); ++f_it )
172
172
{
173
- newComboBox->addItem ( tr ( " Feature %1" ).arg ( f_it->id () ), QString ( " f%1" ).arg ( f_it->id () ) );
173
+ newComboBox->addItem ( tr ( " Feature %1" ).arg ( f_it->id () ), QString ( " f%1" ).arg ( FID_TO_STRING ( f_it->id () ) ) );
174
174
}
175
175
176
176
if ( columnType == QVariant::Double || columnType == QVariant::Int )
@@ -223,7 +223,7 @@ void QgsMergeAttributesDialog::selectedRowChanged()
223
223
{
224
224
// find out selected row
225
225
QList<QTableWidgetItem *> selectionList = mTableWidget ->selectedItems ();
226
- if ( selectionList.size () < 1 )
226
+ if ( selectionList.isEmpty () )
227
227
{
228
228
delete mSelectionRubberBand ;
229
229
mSelectionRubberBand = 0 ;
@@ -245,7 +245,7 @@ void QgsMergeAttributesDialog::selectedRowChanged()
245
245
}
246
246
247
247
bool conversionSuccess = false ;
248
- int featureIdToSelect = idItem->text ().toInt ( &conversionSuccess );
248
+ QgsFeatureId featureIdToSelect = idItem->text ().toLongLong ( &conversionSuccess );
249
249
if ( !conversionSuccess )
250
250
{
251
251
// the merge result row was selected
@@ -275,10 +275,10 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
275
275
{
276
276
mergeResult = tr ( " Skipped" );
277
277
}
278
- else if ( mergeBehaviourString.startsWith ( " f " ) )
278
+ else if ( mergeBehaviourString.startsWith ( ' f ' ) )
279
279
{
280
- // an existing feature value - TODO should be QgsFeatureId, not int
281
- int featureId = mergeBehaviourString.mid ( 1 ). toInt ( );
280
+ // an existing feature value
281
+ QgsFeatureId featureId = STRING_TO_FID ( mergeBehaviourString.mid ( 1 ) );
282
282
mergeResult = featureAttribute ( featureId, col );
283
283
}
284
284
else
@@ -295,7 +295,7 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
295
295
mTableWidget ->setItem ( mTableWidget ->rowCount () - 1 , col, newTotalItem );
296
296
}
297
297
298
- QVariant QgsMergeAttributesDialog::featureAttribute ( int featureId, int col )
298
+ QVariant QgsMergeAttributesDialog::featureAttribute ( QgsFeatureId featureId, int col )
299
299
{
300
300
int idx = mTableWidget ->horizontalHeaderItem ( col )->data ( Qt::UserRole ).toInt ();
301
301
@@ -362,7 +362,7 @@ void QgsMergeAttributesDialog::on_mFromSelectedPushButton_clicked()
362
362
363
363
// find out feature id of selected row
364
364
QList<QTableWidgetItem *> selectionList = mTableWidget ->selectedItems ();
365
- if ( selectionList.size () < 1 )
365
+ if ( selectionList.isEmpty () )
366
366
{
367
367
return ;
368
368
}
@@ -377,7 +377,7 @@ void QgsMergeAttributesDialog::on_mFromSelectedPushButton_clicked()
377
377
}
378
378
379
379
bool conversionSuccess;
380
- int featureId = selectedHeaderItem->text ().toInt ( &conversionSuccess );
380
+ QgsFeatureId featureId = selectedHeaderItem->text ().toLongLong ( &conversionSuccess );
381
381
if ( !conversionSuccess )
382
382
{
383
383
return ;
@@ -393,7 +393,7 @@ void QgsMergeAttributesDialog::on_mFromSelectedPushButton_clicked()
393
393
QComboBox* currentComboBox = qobject_cast<QComboBox *>( mTableWidget ->cellWidget ( 0 , i ) );
394
394
if ( currentComboBox )
395
395
{
396
- currentComboBox->setCurrentIndex ( currentComboBox->findData ( QString::number ( featureId ) ) );
396
+ currentComboBox->setCurrentIndex ( currentComboBox->findData ( QString ( " f%1 " ). arg ( FID_TO_STRING ( featureId ) ) ) );
397
397
}
398
398
}
399
399
}
@@ -407,7 +407,7 @@ void QgsMergeAttributesDialog::on_mRemoveFeatureFromSelectionButton_clicked()
407
407
408
408
// find out feature id of selected row
409
409
QList<QTableWidgetItem *> selectionList = mTableWidget ->selectedItems ();
410
- if ( selectionList.size () < 1 )
410
+ if ( selectionList.isEmpty () )
411
411
{
412
412
return ;
413
413
}
@@ -422,7 +422,7 @@ void QgsMergeAttributesDialog::on_mRemoveFeatureFromSelectionButton_clicked()
422
422
}
423
423
424
424
bool conversionSuccess;
425
- int featureId = selectedHeaderItem->text ().toInt ( &conversionSuccess );
425
+ QgsFeatureId featureId = selectedHeaderItem->text ().toLongLong ( &conversionSuccess );
426
426
if ( !conversionSuccess )
427
427
{
428
428
selectedRowChanged ();
@@ -446,7 +446,7 @@ void QgsMergeAttributesDialog::on_mRemoveFeatureFromSelectionButton_clicked()
446
446
continue ;
447
447
448
448
currentComboBox->blockSignals ( true );
449
- currentComboBox->removeItem ( currentComboBox->findData ( QString::number ( featureId ) ) );
449
+ currentComboBox->removeItem ( currentComboBox->findData ( QString ( " f%1 " ). arg ( FID_TO_STRING ( featureId ) ) ) );
450
450
currentComboBox->blockSignals ( false );
451
451
}
452
452
@@ -463,7 +463,7 @@ void QgsMergeAttributesDialog::on_mRemoveFeatureFromSelectionButton_clicked()
463
463
}
464
464
}
465
465
466
- void QgsMergeAttributesDialog::createRubberBandForFeature ( int featureId )
466
+ void QgsMergeAttributesDialog::createRubberBandForFeature ( QgsFeatureId featureId )
467
467
{
468
468
// create rubber band to highlight the feature
469
469
delete mSelectionRubberBand ;
0 commit comments