Skip to content
Permalink
Browse files
Qt 5.2 has QComboBox::currentData()
  • Loading branch information
3nids committed Sep 21, 2016
1 parent 0542aac commit 6653e779964a5f88e697336ef5600c770c168a88
Showing with 166 additions and 165 deletions.
  1. +1 −1 src/app/composer/qgsattributeselectiondialog.cpp
  2. +1 −1 src/app/composer/qgscomposermanager.cpp
  3. +2 −2 src/app/gps/qgsgpsinformationwidget.cpp
  4. +6 −6 src/app/ogr/qgsvectorlayersaveasdialog.cpp
  5. +1 −1 src/app/qgsaddtaborgroup.cpp
  6. +1 −1 src/app/qgsalignrasterdialog.cpp
  7. +1 −1 src/app/qgsdecorationcopyrightdialog.cpp
  8. +1 −1 src/app/qgsdecorationnortharrowdialog.cpp
  9. +1 −1 src/app/qgsdecorationscalebardialog.cpp
  10. +8 −8 src/app/qgsdiagramproperties.cpp
  11. +1 −1 src/app/qgsfieldcalculator.cpp
  12. +1 −1 src/app/qgsfieldsproperties.cpp
  13. +2 −2 src/app/qgslabelinggui.cpp
  14. +3 −2 src/app/qgsmeasuretool.cpp
  15. +4 −4 src/app/qgsmergeattributesdialog.cpp
  16. +16 −16 src/app/qgsoptions.cpp
  17. +3 −3 src/app/qgsprojectproperties.cpp
  18. +2 −2 src/app/qgsrasterlayerproperties.cpp
  19. +4 −4 src/app/qgsrelationadddlg.cpp
  20. +1 −1 src/app/qgssnappingdialog.cpp
  21. +1 −1 src/app/qgsvectorlayerproperties.cpp
  22. +1 −1 src/auth/identcert/qgsauthidentcertedit.cpp
  23. +1 −1 src/gui/auth/qgsauthauthoritieseditor.cpp
  24. +1 −1 src/gui/auth/qgsauthconfigedit.cpp
  25. +2 −2 src/gui/auth/qgsauthsslconfigwidget.cpp
  26. +1 −1 src/gui/editorwidgets/qgsclassificationwidgetwrapper.cpp
  27. +1 −1 src/gui/editorwidgets/qgsenumerationwidgetwrapper.cpp
  28. +1 −1 src/gui/editorwidgets/qgsexternalresourceconfigdlg.cpp
  29. +1 −1 src/gui/editorwidgets/qgsrangeconfigdlg.cpp
  30. +1 −1 src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp
  31. +1 −1 src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.cpp
  32. +1 −1 src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.cpp
  33. +1 −1 src/gui/editorwidgets/qgsvaluemapwidgetwrapper.cpp
  34. +1 −1 src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.cpp
  35. +1 −1 src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
  36. +1 −1 src/gui/effects/qgspainteffectpropertieswidget.cpp
  37. +1 −1 src/gui/effects/qgspainteffectwidget.cpp
  38. +6 −6 src/gui/qgsattributetypeloaddialog.cpp
  39. +1 −1 src/gui/qgsowssourceselect.cpp
  40. +1 −1 src/gui/qgsprojectionselectionwidget.cpp
  41. +1 −1 src/gui/qgsrasterformatsaveoptionswidget.cpp
  42. +1 −1 src/gui/qgsrasterpyramidsoptionswidget.cpp
  43. +1 −1 src/gui/qgsunitselectionwidget.cpp
  44. +1 −1 src/gui/raster/qgshillshaderendererwidget.cpp
  45. +13 −13 src/gui/raster/qgsmultibandcolorrendererwidget.cpp
  46. +2 −2 src/gui/raster/qgspalettedrendererwidget.cpp
  47. +1 −1 src/gui/raster/qgsrastertransparencywidget.cpp
  48. +1 −1 src/gui/raster/qgsrendererrasterpropertieswidget.cpp
  49. +2 −2 src/gui/raster/qgssinglebandgrayrendererwidget.cpp
  50. +9 −9 src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
  51. +1 −1 src/gui/symbology-ng/qgslayerpropertieswidget.cpp
  52. +1 −1 src/gui/symbology-ng/qgsrendererpropertiesdialog.cpp
  53. +1 −1 src/gui/symbology-ng/qgssizescalewidget.cpp
  54. +2 −2 src/gui/symbology-ng/qgssmartgroupeditordialog.cpp
  55. +1 −1 src/gui/symbology-ng/qgsstyleexportimportdialog.cpp
  56. +1 −1 src/gui/symbology-ng/qgssymbollayerwidget.cpp
  57. +2 −2 src/plugins/georeferencer/qgsgeorefconfigdialog.cpp
  58. +1 −1 src/plugins/georeferencer/qgstransformsettingsdialog.cpp
  59. +1 −1 src/plugins/globe/qgsglobeplugindialog.cpp
  60. +5 −5 src/plugins/globe/qgsglobevectorlayerproperties.cpp
  61. +3 −3 src/plugins/gps_importer/qgsgpsplugingui.cpp
  62. +1 −1 src/plugins/grass/qgsgrassmoduleoptions.cpp
  63. +8 −8 src/plugins/heatmap/heatmapgui.cpp
  64. +1 −1 src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp
  65. +1 −1 src/plugins/roadgraph/exportdlg.cpp
  66. +2 −2 src/plugins/roadgraph/settingsdlg.cpp
  67. +5 −5 src/plugins/spatialquery/qgsspatialquerydialog.cpp
  68. +3 −3 src/plugins/topology/rulesDialog.cpp
  69. +1 −1 src/providers/db2/qgsdb2sourceselect.cpp
  70. +1 −1 src/providers/grass/qgsgrassoptions.cpp
  71. +1 −1 src/providers/mssql/qgsmssqlsourceselect.cpp
  72. +1 −1 src/providers/oracle/qgsoraclesourceselect.cpp
  73. +3 −3 src/providers/postgres/qgspgnewconnection.cpp
  74. +1 −1 src/providers/postgres/qgspgsourceselect.cpp
@@ -76,7 +76,7 @@ void QgsComposerColumnAlignmentDelegate::setEditorData( QWidget* editor, const Q
void QgsComposerColumnAlignmentDelegate::setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const
{
QComboBox *comboBox = static_cast<QComboBox*>( editor );
Qt::AlignmentFlag alignment = ( Qt::AlignmentFlag ) comboBox->itemData( comboBox->currentIndex() ).toInt();
Qt::AlignmentFlag alignment = ( Qt::AlignmentFlag ) comboBox->currentData().toInt();
model->setData( index, alignment, Qt::EditRole );
}

@@ -249,7 +249,7 @@ void QgsComposerManager::on_mAddButton_clicked()
}
else
{
templateFile.setFileName( mTemplate->itemData( mTemplate->currentIndex() ).toString() );
templateFile.setFileName( mTemplate->currentData().toString() );
}

if ( !templateFile.exists() )
@@ -260,7 +260,7 @@ QgsGPSInformationWidget::~QgsGPSInformationWidget()
#endif

QSettings mySettings;
mySettings.setValue( "/gps/lastPort", mCboDevices->itemData( mCboDevices->currentIndex() ).toString() );
mySettings.setValue( "/gps/lastPort", mCboDevices->currentData().toString() );
mySettings.setValue( "/gps/trackWidth", mSpinTrackWidth->value() );
mySettings.setValue( "/gps/trackColor", mTrackColor );
mySettings.setValue( "/gps/markerSize", mSliderMarkerSize->value() );
@@ -396,7 +396,7 @@ void QgsGPSInformationWidget::connectGps()

if ( mRadUserPath->isChecked() )
{
port = mCboDevices->itemData( mCboDevices->currentIndex() ).toString();
port = mCboDevices->currentData().toString();

if ( port.isEmpty() )
{
@@ -518,7 +518,7 @@ QString QgsVectorLayerSaveAsDialog::encoding() const

QString QgsVectorLayerSaveAsDialog::format() const
{
return mFormatComboBox->itemData( mFormatComboBox->currentIndex() ).toString();
return mFormatComboBox->currentData().toString();
}

long QgsVectorLayerSaveAsDialog::crs() const
@@ -551,7 +551,7 @@ QStringList QgsVectorLayerSaveAsDialog::datasourceOptions() const
case QgsVectorFileWriter::Set:
{
QComboBox* cb = mDatasourceOptionsGroupBox->findChild<QComboBox*>( it.key() );
if ( cb && !cb->itemData( cb->currentIndex() ).isNull() )
if ( cb && !cb->currentData().isNull() )
options << QString( "%1=%2" ).arg( it.key(), cb->currentText() );
break;
}
@@ -603,7 +603,7 @@ QStringList QgsVectorLayerSaveAsDialog::layerOptions() const
case QgsVectorFileWriter::Set:
{
QComboBox* cb = mLayerOptionsGroupBox->findChild<QComboBox*>( it.key() );
if ( cb && !cb->itemData( cb->currentIndex() ).isNull() )
if ( cb && !cb->currentData().isNull() )
options << QString( "%1=%2" ).arg( it.key(), cb->currentText() );
break;
}
@@ -669,7 +669,7 @@ bool QgsVectorLayerSaveAsDialog::addToCanvas() const

int QgsVectorLayerSaveAsDialog::symbologyExport() const
{
return mSymbologyExportComboBox->itemData( mSymbologyExportComboBox->currentIndex() ).toInt();
return mSymbologyExportComboBox->currentData().toInt();
}

double QgsVectorLayerSaveAsDialog::scaleDenominator() const
@@ -699,7 +699,7 @@ bool QgsVectorLayerSaveAsDialog::onlySelected() const

QgsWkbTypes::Type QgsVectorLayerSaveAsDialog::geometryType() const
{
int currentIndexData = mGeometryTypeComboBox->itemData( mGeometryTypeComboBox->currentIndex() ).toInt();
int currentIndexData = mGeometryTypeComboBox->currentData().toInt();
if ( currentIndexData == -1 )
{
//automatic
@@ -711,7 +711,7 @@ QgsWkbTypes::Type QgsVectorLayerSaveAsDialog::geometryType() const

bool QgsVectorLayerSaveAsDialog::automaticGeometryType() const
{
int currentIndexData = mGeometryTypeComboBox->itemData( mGeometryTypeComboBox->currentIndex() ).toInt();
int currentIndexData = mGeometryTypeComboBox->currentData().toInt();
return currentIndexData == -1;
}

@@ -68,7 +68,7 @@ QString QgsAddTabOrGroup::name()

QTreeWidgetItem* QgsAddTabOrGroup::tab()
{
TabPair tab = mTabs.at( mTabList->itemData( mTabList->currentIndex() ).toInt() );
TabPair tab = mTabs.at( mTabList->currentData().toInt() );
return tab.second;
}

@@ -439,7 +439,7 @@ QString QgsAlignRasterLayerConfigDialog::outputFilename() const

QgsAlignRaster::ResampleAlg QgsAlignRasterLayerConfigDialog::resampleMethod() const
{
return static_cast< QgsAlignRaster::ResampleAlg >( cboResample->itemData( cboResample->currentIndex() ).toInt() );
return static_cast< QgsAlignRaster::ResampleAlg >( cboResample->currentData().toInt() );
}

bool QgsAlignRasterLayerConfigDialog::rescaleValues() const
@@ -90,7 +90,7 @@ void QgsDecorationCopyrightDialog::apply()
mDeco.mQFont = txtCopyrightText->currentFont();
mDeco.mLabelQString = txtCopyrightText->toPlainText();
mDeco.mLabelQColor = pbnColorChooser->color();
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->itemData( cboPlacement->currentIndex() ).toInt() ) );
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->currentData().toInt() ) );
mDeco.mMarginUnit = wgtUnitSelection->unit();
mDeco.mMarginHorizontal = spnHorizontal->value();
mDeco.mMarginVertical = spnVertical->value();
@@ -93,7 +93,7 @@ void QgsDecorationNorthArrowDialog::on_sliderRotation_valueChanged( int theInt )
void QgsDecorationNorthArrowDialog::apply()
{
mDeco.mRotationInt = sliderRotation->value();
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->itemData( cboPlacement->currentIndex() ).toInt() ) );
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->currentData().toInt() ) );
mDeco.mMarginUnit = wgtUnitSelection->unit();
mDeco.setEnabled( grpEnable->isChecked() );
mDeco.mAutomatic = cboxAutomatic->isChecked();
@@ -89,7 +89,7 @@ void QgsDecorationScaleBarDialog::on_buttonBox_helpRequested()

void QgsDecorationScaleBarDialog::apply()
{
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->itemData( cboPlacement->currentIndex() ).toInt() ) );
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->currentData().toInt() ) );
mDeco.mMarginUnit = wgtUnitSelection->unit();
mDeco.mMarginHorizontal = spnHorizontal->value();
mDeco.mMarginVertical = spnVertical->value();
@@ -667,7 +667,7 @@ void QgsDiagramProperties::apply()
}
else
{
maxVal = provider->maximumValue( mSizeAttributeComboBox->itemData( mSizeAttributeComboBox->currentIndex() ).toInt() ).toDouble();
maxVal = provider->maximumValue( mSizeAttributeComboBox->currentData().toInt() ).toDouble();
}
}

@@ -724,8 +724,8 @@ void QgsDiagramProperties::apply()
ds.sizeScale = mDiagramUnitComboBox->getMapUnitScale();
ds.lineSizeUnit = mDiagramLineUnitComboBox->unit();
ds.lineSizeScale = mDiagramLineUnitComboBox->getMapUnitScale();
ds.labelPlacementMethod = static_cast<QgsDiagramSettings::LabelPlacementMethod>( mLabelPlacementComboBox->itemData( mLabelPlacementComboBox->currentIndex() ).toInt() );
ds.scaleByArea = mScaleDependencyComboBox->itemData( mScaleDependencyComboBox->currentIndex() ).toBool();
ds.labelPlacementMethod = static_cast<QgsDiagramSettings::LabelPlacementMethod>( mLabelPlacementComboBox->currentData().toInt() );
ds.scaleByArea = mScaleDependencyComboBox->currentData().toBool();

if ( mIncreaseSmallDiagramsCheck->isChecked() )
{
@@ -745,7 +745,7 @@ void QgsDiagramProperties::apply()
ds.scaleBasedVisibility = mScaleVisibilityGroupBox->isChecked();

// Diagram angle offset (pie)
ds.angleOffset = mAngleOffsetComboBox->itemData( mAngleOffsetComboBox->currentIndex() ).toInt();
ds.angleOffset = mAngleOffsetComboBox->currentData().toInt();

// Diagram orientation (histogram)
ds.diagramOrientation = static_cast<QgsDiagramSettings::DiagramOrientation>( mOrientationButtonGroup->checkedButton()->property( "direction" ).toInt() );
@@ -795,23 +795,23 @@ void QgsDiagramProperties::apply()
dls.setShowAllDiagrams( mShowAllCheckBox->isChecked() );
if ( mDataDefinedVisibilityGroupBox->isChecked() )
{
dls.showColumn = mDataDefinedVisibilityComboBox->itemData( mDataDefinedVisibilityComboBox->currentIndex() ).toInt();
dls.showColumn = mDataDefinedVisibilityComboBox->currentData().toInt();
}
else
{
dls.showColumn = -1;
}
if ( mDataDefinedPositionGroupBox->isChecked() )
{
dls.xPosColumn = mDataDefinedXComboBox->itemData( mDataDefinedXComboBox->currentIndex() ).toInt();
dls.yPosColumn = mDataDefinedYComboBox->itemData( mDataDefinedYComboBox->currentIndex() ).toInt();
dls.xPosColumn = mDataDefinedXComboBox->currentData().toInt();
dls.yPosColumn = mDataDefinedYComboBox->currentData().toInt();
}
else
{
dls.xPosColumn = -1;
dls.yPosColumn = -1;
}
dls.setPlacement(( QgsDiagramLayerSettings::Placement )mPlacementComboBox->itemData( mPlacementComboBox->currentIndex() ).toInt() );
dls.setPlacement(( QgsDiagramLayerSettings::Placement )mPlacementComboBox->currentData().toInt() );

unsigned int flags = 0;
if ( chkLineAbove->isChecked() )
@@ -201,7 +201,7 @@ void QgsFieldCalculator::accept()
//update existing field
if ( mUpdateExistingGroupBox->isChecked() || !mNewFieldGroupBox->isEnabled() )
{
if ( mExistingFieldComboBox->itemData( mExistingFieldComboBox->currentIndex() ).toString() == "geom" )
if ( mExistingFieldComboBox->currentData().toString() == "geom" )
{
//update geometry
mAttributeId = -1;
@@ -994,7 +994,7 @@ void QgsFieldsProperties::apply()
QgsEditorWidgetConfig cfg;

QComboBox* cb = qobject_cast<QComboBox*>( mRelationsList->cellWidget( i, RelNmCol ) );
QVariant otherRelation = cb->itemData( cb->currentIndex() );
QVariant otherRelation = cb->currentData();

if ( otherRelation.isValid() )
{
@@ -940,7 +940,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
lyr.dist = mLineDistanceSpnBx->value();
lyr.distInMapUnits = ( mLineDistanceUnitWidget->unit() == QgsUnitTypes::RenderMapUnits );
lyr.distMapUnitScale = mLineDistanceUnitWidget->getMapUnitScale();
lyr.offsetType = static_cast< QgsPalLayerSettings::OffsetType >( mOffsetTypeComboBox->itemData( mOffsetTypeComboBox->currentIndex() ).toInt() );
lyr.offsetType = static_cast< QgsPalLayerSettings::OffsetType >( mOffsetTypeComboBox->currentData().toInt() );
lyr.quadOffset = ( QgsPalLayerSettings::QuadrantPosition )mQuadrantBtnGrp->checkedId();
lyr.xOffset = mPointOffsetXSpinBox->value();
lyr.yOffset = mPointOffsetYSpinBox->value();
@@ -1010,7 +1010,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
lyr.priority = mPrioritySlider->value();
lyr.obstacle = mChkNoObstacle->isChecked() || mMode == ObstaclesOnly;
lyr.obstacleFactor = mObstacleFactorSlider->value() / 50.0;
lyr.obstacleType = ( QgsPalLayerSettings::ObstacleType )mObstacleTypeComboBox->itemData( mObstacleTypeComboBox->currentIndex() ).toInt();
lyr.obstacleType = ( QgsPalLayerSettings::ObstacleType )mObstacleTypeComboBox->currentData().toInt();
lyr.labelPerPart = chkLabelPerFeaturePart->isChecked();
lyr.displayAll = mPalShowAllLabelsForLayerChkBx->isChecked();
lyr.mergeLines = chkMergeLines->isChecked();
@@ -206,14 +206,15 @@ void QgsMeasureTool::canvasReleaseEvent( QgsMapMouseEvent* e )
if ( e->button() == Qt::RightButton ) // if we clicked the right button we stop measuring
{
mDone = true;
mRubberBand->removeLastPoint();
mDialog->removeLastPoint();
}
else if ( e->button() == Qt::LeftButton )
{
mDone = false;
addPoint( point );
}

// we always add the clicked point to the measuring feature
addPoint( point );
mDialog->show();

}
@@ -289,7 +289,7 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
}

//evaluate behaviour (feature value or min / max / mean )
QString mergeBehaviourString = comboBox->itemData( comboBox->currentIndex() ).toString();
QString mergeBehaviourString = comboBox->currentData().toString();
QVariant mergeResult; // result to show in the merge result field
if ( mergeBehaviourString == "concat" )
{
@@ -312,7 +312,7 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
else
{
//numerical statistic
QgsStatisticalSummary::Statistic stat = ( QgsStatisticalSummary::Statistic )( comboBox->itemData( comboBox->currentIndex() ).toInt() );
QgsStatisticalSummary::Statistic stat = ( QgsStatisticalSummary::Statistic )( comboBox->currentData().toInt() );
mergeResult = calcStatistic( col, stat );
}

@@ -557,7 +557,7 @@ QgsAttributes QgsMergeAttributesDialog::mergedAttributes() const
if ( fieldIdx >= results.count() )
results.resize( fieldIdx + 1 ); // make sure the results vector is long enough (maybe not necessary)

if ( comboBox->itemData( comboBox->currentIndex() ).toString() != "skip" )
if ( comboBox->currentData().toString() != "skip" )
{
results[fieldIdx] = currentItem->data( Qt::DisplayRole );
}
@@ -595,7 +595,7 @@ QSet<int> QgsMergeAttributesDialog::skippedAttributeIndexes() const
continue;
}

if ( comboBox->itemData( comboBox->currentIndex() ).toString() == "skip" )
if ( comboBox->currentData().toString() == "skip" )
{
skipped << i;
}
Loading

1 comment on commit 6653e77

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson commented on 6653e77 Sep 21, 2016

That's MUCH nicer, thanks!

Please sign in to comment.