Skip to content

Commit 29fc46a

Browse files
committed
Merge pull request #2318 from slarosa/fix_crash_export_ramp
[stylemanager dialog] fix crash when exporting to PNG/SVG color ramp
2 parents 4897cdf + 7a41a2d commit 29fc46a

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/gui/symbology-ng/qgsstylev2managerdialog.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,14 @@ void QgsStyleV2ManagerDialog::on_tabItemType_currentChanged( int )
185185
// when in Color Ramp tab, add menu to add item button
186186
if ( currentItemType() == 3 )
187187
{
188+
btnShare->menu()->actions().at( 0 )->setVisible( false );
189+
btnShare->menu()->actions().at( 1 )->setVisible( false );
190+
188191
QStringList rampTypes;
189192
rampTypes << tr( "Gradient" ) << tr( "Random" ) << tr( "ColorBrewer" );
190193
rampTypes << tr( "cpt-city" ); // todo, only for rasters?
191194
QMenu* menu = new QMenu( btnAddItem );
192-
Q_FOREACH ( const QString& rampType, rampTypes )
195+
Q_FOREACH( const QString& rampType, rampTypes )
193196
{
194197
menu->addAction( rampType );
195198
}
@@ -199,6 +202,9 @@ void QgsStyleV2ManagerDialog::on_tabItemType_currentChanged( int )
199202
}
200203
else
201204
{
205+
btnShare->menu()->actions().at( 0 )->setVisible( true );
206+
btnShare->menu()->actions().at( 1 )->setVisible( true );
207+
202208
if ( btnAddItem->menu() )
203209
{
204210
disconnect( btnAddItem->menu(), SIGNAL( triggered( QAction* ) ),
@@ -685,7 +691,7 @@ void QgsStyleV2ManagerDialog::removeItem()
685691
bool QgsStyleV2ManagerDialog::removeSymbol()
686692
{
687693
QModelIndexList indexes = listItems->selectionModel()->selectedIndexes();
688-
Q_FOREACH ( const QModelIndex& index, indexes )
694+
Q_FOREACH( const QModelIndex& index, indexes )
689695
{
690696
QString symbolName = index.data().toString();
691697
// delete from style and update list
@@ -760,7 +766,7 @@ void QgsStyleV2ManagerDialog::exportSelectedItemsImages( QString dir, QString fo
760766
return;
761767

762768
QModelIndexList indexes = listItems->selectionModel()->selection().indexes();
763-
Q_FOREACH ( const QModelIndex& index, indexes )
769+
Q_FOREACH( const QModelIndex& index, indexes )
764770
{
765771
QString name = index.data().toString();
766772
QString path = dir + "/" + name + "." + format;
@@ -1151,11 +1157,11 @@ void QgsStyleV2ManagerDialog::regrouped( QStandardItem *item )
11511157
void QgsStyleV2ManagerDialog::setSymbolsChecked( QStringList symbols )
11521158
{
11531159
QStandardItemModel *model = qobject_cast<QStandardItemModel*>( listItems->model() );
1154-
Q_FOREACH ( const QString& symbol, symbols )
1160+
Q_FOREACH( const QString& symbol, symbols )
11551161
{
11561162
QList<QStandardItem*> items = model->findItems( symbol );
1157-
Q_FOREACH ( QStandardItem* item, items )
1158-
item->setCheckState( Qt::Checked );
1163+
Q_FOREACH( QStandardItem* item, items )
1164+
item->setCheckState( Qt::Checked );
11591165
}
11601166
}
11611167

@@ -1198,27 +1204,27 @@ void QgsStyleV2ManagerDialog::tagsChanged()
11981204
return;
11991205
}
12001206
// compare old with new to find removed tags
1201-
Q_FOREACH ( const QString &tag, oldtags )
1207+
Q_FOREACH( const QString &tag, oldtags )
12021208
{
12031209
if ( !newtags.contains( tag ) )
12041210
removetags.append( tag );
12051211
}
12061212
if ( removetags.size() > 0 )
12071213
{
1208-
Q_FOREACH ( const QModelIndex& index, indexes )
1214+
Q_FOREACH( const QModelIndex& index, indexes )
12091215
{
12101216
mStyle->detagSymbol( type, index.data().toString(), removetags );
12111217
}
12121218
}
12131219
// compare new with old to find added tags
1214-
Q_FOREACH ( const QString &tag, newtags )
1220+
Q_FOREACH( const QString &tag, newtags )
12151221
{
12161222
if ( !oldtags.contains( tag ) )
12171223
addtags.append( tag );
12181224
}
12191225
if ( addtags.size() > 0 )
12201226
{
1221-
Q_FOREACH ( const QModelIndex& index, indexes )
1227+
Q_FOREACH( const QModelIndex& index, indexes )
12221228
{
12231229
mStyle->tagSymbol( type, index.data().toString(), addtags );
12241230
}
@@ -1339,7 +1345,7 @@ void QgsStyleV2ManagerDialog::listitemsContextMenu( const QPoint& point )
13391345
groupList->setTitle( tr( "Apply Group" ) );
13401346

13411347
QStringList groups = mStyle->groupNames();
1342-
Q_FOREACH ( const QString& group, groups )
1348+
Q_FOREACH( const QString& group, groups )
13431349
{
13441350
groupList->addAction( group );
13451351
}
@@ -1362,7 +1368,7 @@ void QgsStyleV2ManagerDialog::listitemsContextMenu( const QPoint& point )
13621368
groupId = mStyle->groupId( selectedItem->text() );
13631369
}
13641370
QModelIndexList indexes = listItems->selectionModel()->selectedIndexes();
1365-
Q_FOREACH ( const QModelIndex& index, indexes )
1371+
Q_FOREACH( const QModelIndex& index, indexes )
13661372
{
13671373
mStyle->group( type, index.data().toString(), groupId );
13681374
}

0 commit comments

Comments
 (0)