Skip to content
Permalink
Browse files

Fix class name

  • Loading branch information
Stéphane Brunner
Stéphane Brunner committed Sep 14, 2013
1 parent 0edf0d2 commit 9494365b326b26b3e20c45da2a428d7e6fbc9a02
Showing with 34 additions and 21 deletions.
  1. +34 −21 src/core/composer/qgslegendmodel.cpp
@@ -163,37 +163,50 @@ int QgsLegendModel::addVectorLayerItemsV2( QStandardItem* layerItem, QgsVectorLa
int row = 0;
for ( ; symbolIt != lst.constEnd(); ++symbolIt )
{
QgsComposerSymbolV2Item* currentSymbolItem = new QgsComposerSymbolV2Item( "" );

// Get userText from old item if exists
QgsComposerSymbolV2Item* oldSymbolItem = dynamic_cast<QgsComposerSymbolV2Item*>( layerItem->child( row, 0 ) );
if ( oldSymbolItem )
if ( scaleDenominator == -1 )
{
currentSymbolItem->setUserText( oldSymbolItem->userText() );
QgsComposerSymbolV2Item* currentSymbolItem = new QgsComposerSymbolV2Item( "" );

}
// Get userText from old item if exists
QgsComposerSymbolV2Item* oldSymbolItem = dynamic_cast<QgsComposerSymbolV2Item*>( layerItem->child( row, 0 ) );
if ( oldSymbolItem )
{
currentSymbolItem->setUserText( oldSymbolItem->userText() );
}

currentSymbolItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
if ( symbolIt->second )
{
if ( mHasTopLevelWindow ) //only use QIcon / QPixmap if we have a running x-server
currentSymbolItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
if ( symbolIt->second )
{
currentSymbolItem->setIcon( QgsSymbolLayerV2Utils::symbolPreviewIcon( symbolIt->second, QSize( 30, 30 ) ) );
if ( mHasTopLevelWindow ) //only use QIcon / QPixmap if we have a running x-server
{
currentSymbolItem->setIcon( QgsSymbolLayerV2Utils::symbolPreviewIcon( symbolIt->second, QSize( 30, 30 ) ) );
}
currentSymbolItem->setSymbolV2( symbolIt->second->clone() );
}
currentSymbolItem->setSymbolV2( symbolIt->second->clone() );
}
layerItem->setChild( row, 0, currentSymbolItem );
layerItem->setChild( row, 0, currentSymbolItem );

// updateSymbolV2ItemText needs layer set
updateSymbolV2ItemText( currentSymbolItem );
// updateSymbolV2ItemText needs layer set
updateSymbolV2ItemText( currentSymbolItem );

row++;
row++;
}
else
{
QgsComposerSymbolV2Item* currentSymbolItem = new QgsComposerSymbolV2Item( "" );
currentSymbolItem->setIcon( QgsSymbolLayerV2Utils::symbolPreviewIcon( symbolIt->second, QSize( 30, 30 ) ) );
currentSymbolItem->setSymbolV2( symbolIt->second );
layerItem->setChild( 0, 0, currentSymbolItem );
currentSymbolItem->setText( symbolIt->first );
}
}

// Delete following old items (if current number of items decreased)
for ( int i = layerItem->rowCount() - 1; i >= row; --i )
if ( scaleDenominator == -1 )
{
layerItem->removeRow( i );
// Delete following old items (if current number of items decreased)
for ( int i = layerItem->rowCount() - 1; i >= row; --i )
{
layerItem->removeRow( i );
}
}

return 0;

0 comments on commit 9494365

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