Skip to content
Permalink
Browse files

For consistency, always store custom data in first column in bad laye…

…rs table items

(cherry picked from commit 1c2d3a5)
  • Loading branch information
nyalldawson committed Mar 11, 2021
1 parent 13d3ce0 commit ece98c3a6ca655a3d23482fff221eacbdcb0614c
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/app/qgshandlebadlayers.cpp
@@ -148,12 +148,12 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers )

item = new QTableWidgetItem( name );
item->setData( static_cast< int >( CustomRoles::Index ), i );
item->setData( static_cast< int >( CustomRoles::ProviderIsFileBased ), providerFileBased );
item->setData( static_cast< int >( CustomRoles::LayerId ), layerId );
item->setFlags( item->flags() & ~Qt::ItemIsEditable );
mLayerList->setItem( j, 0, item );

item = new QTableWidgetItem( type );
item->setData( static_cast< int >( CustomRoles::ProviderIsFileBased ), providerFileBased );
item->setData( static_cast< int >( CustomRoles::LayerId ), layerId );
item->setFlags( item->flags() & ~Qt::ItemIsEditable );
mLayerList->setItem( j, 1, item );

@@ -197,7 +197,7 @@ void QgsHandleBadLayers::selectionChanged()
if ( item->column() != 0 )
continue;

const bool providerFileBased = mLayerList->item( item->row(), 1 )->data( static_cast< int >( CustomRoles::ProviderIsFileBased ) ).toBool();
const bool providerFileBased = mLayerList->item( item->row(), 0 )->data( static_cast< int >( CustomRoles::ProviderIsFileBased ) ).toBool();
if ( !providerFileBased )
continue;

@@ -323,7 +323,7 @@ void QgsHandleBadLayers::browseClicked()

for ( int row : qgis::as_const( mRows ) )
{
const bool providerFileBased = mLayerList->item( row, 1 )->data( static_cast< int >( CustomRoles::ProviderIsFileBased ) ).toBool();
const bool providerFileBased = mLayerList->item( row, 0 )->data( static_cast< int >( CustomRoles::ProviderIsFileBased ) ).toBool();
if ( !providerFileBased )
continue;

@@ -414,7 +414,7 @@ void QgsHandleBadLayers::apply()
fileName = longName;
}

const QVariant dataSourceIsChanged = item->data( static_cast< int >( CustomRoles::DataSourceIsChanged ) );
const QVariant dataSourceIsChanged = mLayerList->item( i, 0 )->data( static_cast< int >( CustomRoles::DataSourceIsChanged ) );
if ( !( dataSourceIsChanged.isValid() && dataSourceIsChanged.toBool() ) )
{
datasource = QDir::toNativeSeparators( checkBasepath( layerId, basepath, fileName ).replace( fileName, longName ) );
@@ -661,7 +661,7 @@ void QgsHandleBadLayers::autoFind()
setFilename( i, datasource );
item->setText( datasource );
item->setForeground( QBrush( Qt::green ) );
item->setData( static_cast< int >( CustomRoles::DataSourceIsChanged ), QVariant( true ) );
mLayerList->item( i, 0 )->setData( static_cast< int >( CustomRoles::DataSourceIsChanged ), QVariant( true ) );
}
else
{

0 comments on commit ece98c3

Please sign in to comment.