Skip to content
Permalink
Browse files

Fix incorrect rows are removed when removing vector tile renderer/lab…

…eling rules
  • Loading branch information
nyalldawson committed Sep 14, 2020
1 parent d214e63 commit 91598c7849e50241749babd7121ecdef85938a9e
@@ -459,11 +459,19 @@ void QgsVectorTileBasicLabelingWidget::updateLabelingFromWidget()
void QgsVectorTileBasicLabelingWidget::removeStyle()
{
const QModelIndexList sel = viewStyles->selectionModel()->selectedIndexes();

QList<int > res;
for ( const QModelIndex &proxyIndex : sel )
{
const QModelIndex sourceIndex = mProxyModel->mapToSource( proxyIndex );
if ( sourceIndex.isValid() )
mModel->removeRow( sourceIndex.row() );
if ( !res.contains( sourceIndex.row() ) )
res << sourceIndex.row();
}
std::sort( res.begin(), res.end() );

for ( int i = res.size() - 1; i >= 0; --i )
{
mModel->removeRow( res[ i ] );
}
// make sure that the selection is gone
viewStyles->selectionModel()->clear();
@@ -474,11 +474,19 @@ void QgsVectorTileBasicRendererWidget::cleanUpSymbolSelector( QgsPanelWidget *co
void QgsVectorTileBasicRendererWidget::removeStyle()
{
const QModelIndexList sel = viewStyles->selectionModel()->selectedIndexes();

QList<int > res;
for ( const QModelIndex &proxyIndex : sel )
{
const QModelIndex sourceIndex = mProxyModel->mapToSource( proxyIndex );
if ( sourceIndex.isValid() )
mModel->removeRow( sourceIndex.row() );
if ( !res.contains( sourceIndex.row() ) )
res << sourceIndex.row();
}
std::sort( res.begin(), res.end() );

for ( int i = res.size() - 1; i >= 0; --i )
{
mModel->removeRow( res[ i ] );
}
// make sure that the selection is gone
viewStyles->selectionModel()->clear();

0 comments on commit 91598c7

Please sign in to comment.
You can’t perform that action at this time.