[QGIS Commit] r13071 - in trunk/qgis/src: app app/legend ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Mar 18 14:12:05 EDT 2010


Author: jef
Date: 2010-03-18 14:12:04 -0400 (Thu, 18 Mar 2010)
New Revision: 13071

Modified:
   trunk/qgis/src/app/legend/qgslegend.cpp
   trunk/qgis/src/app/qgsoptions.cpp
   trunk/qgis/src/ui/qgsoptionsbase.ui
Log:
[FEATURE] optionally add new layers to the selected group

Modified: trunk/qgis/src/app/legend/qgslegend.cpp
===================================================================
--- trunk/qgis/src/app/legend/qgslegend.cpp	2010-03-18 18:00:44 UTC (rev 13070)
+++ trunk/qgis/src/app/legend/qgslegend.cpp	2010-03-18 18:12:04 UTC (rev 13071)
@@ -520,7 +520,18 @@
   }
   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 @@
     mMapCanvas->zoomToFullExtent();
     mMapCanvas->clearExtentHistory();
   }
-  setCurrentItem( llayer );
   //make the QTreeWidget item up-to-date
   doItemsLayout();
 }

Modified: trunk/qgis/src/app/qgsoptions.cpp
===================================================================
--- trunk/qgis/src/app/qgsoptions.cpp	2010-03-18 18:00:44 UTC (rev 13070)
+++ trunk/qgis/src/app/qgsoptions.cpp	2010-03-18 18:12:04 UTC (rev 13071)
@@ -206,6 +206,7 @@
   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 @@
   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() );

Modified: trunk/qgis/src/ui/qgsoptionsbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsoptionsbase.ui	2010-03-18 18:00:44 UTC (rev 13070)
+++ trunk/qgis/src/ui/qgsoptionsbase.ui	2010-03-18 18:12:04 UTC (rev 13071)
@@ -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>



More information about the QGIS-commit mailing list