@@ -3073,27 +3073,11 @@ void QgisApp::removeAllFromOverview()
30733073// reimplements method from base (gui) class
30743074void QgisApp::hideAllLayers ()
30753075{
3076- // what's the point if we don't have any layers?
3077- if ( QgsMapLayerRegistry::instance ()->mapLayers ().empty () )
3078- {
3079- return ;
3080- }
3081-
30823076#ifdef QGISDEBUG
30833077 std::cout << " hiding all layers!" << std::endl;
30843078#endif
30853079
3086- mMapCanvas ->freeze (true );
3087- std::map<QString, QgsMapLayer *> myMapLayers = QgsMapLayerRegistry::instance ()->mapLayers ();
3088- std::map<QString, QgsMapLayer *>::iterator myMapIterator;
3089- for ( myMapIterator = myMapLayers.begin (); myMapIterator != myMapLayers.end (); ++myMapIterator )
3090- {
3091- QgsMapLayer * myMapLayer = myMapIterator->second ;
3092- myMapLayer->setVisible (false );
3093- }
3094- // draw the map
3095- mMapCanvas ->freeze (false );
3096- mMapCanvas ->refresh ();
3080+ legend ()->selectAll (false );
30973081
30983082 // notify the project we've made a change
30993083 QgsProject::instance ()->dirty (true );
@@ -3103,27 +3087,11 @@ void QgisApp::hideAllLayers()
31033087// reimplements method from base (gui) class
31043088void QgisApp::showAllLayers ()
31053089{
3106- // what's the point if we don't have any layers?
3107- if ( QgsMapLayerRegistry::instance ()->mapLayers ().empty () )
3108- {
3109- return ;
3110- }
3111-
31123090#ifdef QGISDEBUG
31133091 std::cout << " Showing all layers!" << std::endl;
31143092#endif
31153093
3116- mMapCanvas ->freeze (true );
3117- std::map<QString, QgsMapLayer *> myMapLayers = QgsMapLayerRegistry::instance ()->mapLayers ();
3118- std::map<QString, QgsMapLayer *>::iterator myMapIterator;
3119- for ( myMapIterator = myMapLayers.begin (); myMapIterator != myMapLayers.end (); ++myMapIterator )
3120- {
3121- QgsMapLayer * myMapLayer = myMapIterator->second ;
3122- myMapLayer->setVisible (true );
3123- }
3124- // draw the map
3125- mMapCanvas ->freeze (false );
3126- mMapCanvas ->refresh ();
3094+ legend ()->selectAll (true );
31273095
31283096 // notify the project we've made a change
31293097 QgsProject::instance ()->dirty (true );
0 commit comments