void QgsSpatialQueryDialog::on_ckbZoomItem_clicked( bool checked ) { if ( checked ) { if ( lwFeatures->count() > 0 ) { QgsFeatureId fid = STRING_TO_FID( lwFeatures->currentItem()->data( Qt::UserRole ).toString() ); TypeItems typeItem = ( TypeItems )( cbTypeItems->itemData( cbTypeItems->currentIndex() ).toInt() ); QgsVectorLayer *lyr = typeItem == itemsInvalidReference ? mLayerReference : mLayerTarget; zoomFeature( lyr, fid ); } } } // QgsSpatialQueryDialog::on_ckbZoomItem_clicked( bool checked )
void QgsMergeAttributesDialog::refreshMergedValue( int col ) { QComboBox *comboBox = qobject_cast<QComboBox *>( mTableWidget->cellWidget( 0, col ) ); if ( !comboBox ) { return; } int fieldIdx = mTableWidget->horizontalHeaderItem( col )->data( FieldIndex ).toInt(); //evaluate behavior (feature value or min / max / mean ) QString mergeBehaviorString = comboBox->currentData().toString(); QVariant mergeResult; // result to show in the merge result field if ( mergeBehaviorString == QLatin1String( "concat" ) ) { mergeResult = concatenationAttribute( col ); } else if ( mergeBehaviorString == QLatin1String( "skip" ) ) { mergeResult = tr( "Skipped" ); } else if ( mergeBehaviorString == QLatin1String( "manual" ) ) { return; //nothing to do } else if ( mergeBehaviorString.startsWith( 'f' ) ) { //an existing feature value QgsFeatureId featureId = STRING_TO_FID( mergeBehaviorString.mid( 1 ) ); mergeResult = featureAttribute( featureId, fieldIdx ); } else { //numerical statistic QgsStatisticalSummary::Statistic stat = ( QgsStatisticalSummary::Statistic )( comboBox->currentData().toInt() ); mergeResult = calcStatistic( fieldIdx, stat ); } //insert string into table widget mUpdating = true; // prevent combobox changing to "manual" value QTableWidgetItem *item = mTableWidget->item( mTableWidget->rowCount() - 1, col ); item->setData( Qt::DisplayRole, mergeResult ); mUpdating = false; }
void QgsSpatialQueryDialog::on_lwFeatures_currentItemChanged( QListWidgetItem * item ) { TypeItems typeItem = ( TypeItems )( cbTypeItems->itemData( cbTypeItems->currentIndex() ).toInt() ); QgsVectorLayer *lyr = typeItem == itemsInvalidReference ? mLayerReference : mLayerTarget; changeLwFeature( lyr, STRING_TO_FID( item->data( Qt::UserRole ).toString() ) ); } // void QgsSpatialQueryDialog::on_lwFeatures_currentItemChanged( QListWidgetItem * item )