Skip to content
Permalink
Browse files

[FEATURE] optionally add new layers to the selected group

git-svn-id: http://svn.osgeo.org/qgis/trunk@13071 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 18, 2010
1 parent 80f1e54 commit 116dfc872810a5e3bd24e82d1fb2a168b7eb94bc
Showing with 21 additions and 2 deletions.
  1. +12 −2 src/app/legend/qgslegend.cpp
  2. +2 −0 src/app/qgsoptions.cpp
  3. +7 −0 src/ui/qgsoptionsbase.ui
@@ -520,7 +520,18 @@ void QgsLegend::addLayer( QgsMapLayer * layer )
}
blockSignals( false );

insertTopLevelItem( 0, llayer );
QgsLegendGroup *lg = dynamic_cast<QgsLegendGroup *>( currentItem() );
QSettings settings;
if ( lg && settings.value( "/qgis/addNewLayersToCurrentGroup", false ).toBool() )
{
lg->insertChild( 0, llayer );
}
else
{
insertTopLevelItem( 0, llayer );
setCurrentItem( llayer );
}

setItemExpanded( llayer, true );

refreshLayerSymbology( layer->getLayerID() );
@@ -533,7 +544,6 @@ void QgsLegend::addLayer( QgsMapLayer * layer )
mMapCanvas->zoomToFullExtent();
mMapCanvas->clearExtentHistory();
}
setCurrentItem( llayer );
//make the QTreeWidget item up-to-date
doItemsLayout();
}
@@ -206,6 +206,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
cbxAttributeTableDocked->setChecked( settings.value( "/qgis/dockAttributeTable", false ).toBool() );
cbxIdentifyResultsDocked->setChecked( settings.value( "/qgis/dockIdentifyResults", false ).toBool() );
cbxAddPostgisDC->setChecked( settings.value( "/qgis/addPostgisDC", false ).toBool() );
cbxAddNewLayersToCurrentGroup->setChecked( settings.value( "/qgis/addNewLayersToCurrentGroup", false ).toBool() );

//set the color for selections
int myRed = settings.value( "/qgis/default_selection_color_red", 255 ).toInt();
@@ -454,6 +455,7 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/dockAttributeTable", cbxAttributeTableDocked->isChecked() );
settings.setValue( "/qgis/dockIdentifyResults", cbxIdentifyResultsDocked->isChecked() );
settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
settings.setValue( "/qgis/addNewLayersToCurrentGroup", cbxAddNewLayersToCurrentGroup->isChecked() );
settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
settings.setValue( "/qgis/enable_render_caching", chkUseRenderCaching->isChecked() );
@@ -362,6 +362,13 @@
</item>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="cbxAddNewLayersToCurrentGroup">
<property name="text">
<string>Add new layers to selected group</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

0 comments on commit 116dfc8

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