Skip to content
Permalink
Browse files

fix #3109

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14377 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Oct 13, 2010
1 parent 6b5ba50 commit f0941ddc39052c538b922077a66362e9b1cf3046
Showing with 28 additions and 25 deletions.
  1. +18 −19 src/app/legend/qgslegend.cpp
  2. +9 −5 src/app/qgisapp.cpp
  3. +1 −1 src/gui/qgsmapcanvas.cpp
@@ -155,7 +155,8 @@ void QgsLegend::selectAll( bool select )

// Turn off rendering to improve speed.
bool renderFlagState = mMapCanvas->renderFlag();
mMapCanvas->setRenderFlag( false );
if ( renderFlagState )
mMapCanvas->setRenderFlag( false );

for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
{
@@ -168,7 +169,8 @@ void QgsLegend::selectAll( bool select )
}

// Turn on rendering (if it was on previously)
mMapCanvas->setRenderFlag( renderFlagState );
if ( renderFlagState )
mMapCanvas->setRenderFlag( true );

QgsProject::instance()->dirty( true );
}
@@ -1483,8 +1485,6 @@ void QgsLegend::handleItemChange( QTreeWidgetItem* item, int row )
return;
}

bool renderFlagState = mMapCanvas->renderFlag();

//if the text of a QgsLegendLayer has changed, change the display names of all its maplayers
// TODO: is this still necessary?
QgsLegendLayer* theLegendLayer = dynamic_cast<QgsLegendLayer *>( item ); //item is a legend layer
@@ -1497,13 +1497,16 @@ void QgsLegend::handleItemChange( QTreeWidgetItem* item, int row )
if ( item->data( 0, Qt::UserRole ).toInt() == item->checkState( 0 ) )
return;

bool renderFlagState = mMapCanvas->renderFlag();
if ( renderFlagState )
mMapCanvas->setRenderFlag( false );

QgsLegendGroup* lg = dynamic_cast<QgsLegendGroup *>( item ); //item is a legend group
if ( lg )
{
//set all the child layer files to the new check state
std::list<QgsLegendLayer*> subfiles = lg->legendLayers();
bool renderFlagState = mMapCanvas->renderFlag();
mMapCanvas->setRenderFlag( false );

for ( std::list<QgsLegendLayer*>::iterator iter = subfiles.begin(); iter != subfiles.end(); ++iter )
{
#ifdef QGISDEBUG
@@ -1530,10 +1533,6 @@ void QgsLegend::handleItemChange( QTreeWidgetItem* item, int row )
}
}

// If it was on, turn it back on, otherwise leave it
// off, as turning it on causes a refresh.
if ( renderFlagState )
mMapCanvas->setRenderFlag( true );
item->setData( 0, Qt::UserRole, item->checkState( 0 ) );
}

@@ -1554,19 +1553,17 @@ void QgsLegend::handleItemChange( QTreeWidgetItem* item, int row )
static_cast<QgsLegendGroup*>( ll->parent() )->updateCheckState();
ll->parent()->setData( 0, Qt::UserRole, ll->parent()->checkState( 0 ) );
}
// If it was on, turn it back on, otherwise leave it
// off, as turning it on causes a refresh.
if ( renderFlagState )
{
mMapCanvas->setRenderFlag( true );
}
mMapCanvas->freeze( false );
//update check state of the legend group
item->setData( 0, Qt::UserRole, item->checkState( 0 ) );
}

// update layer set
updateMapCanvasLayerSet();

// If it was on, turn it back on, otherwise leave it
// off, as turning it on causes a refresh.
if ( renderFlagState )
mMapCanvas->setRenderFlag( true );
}

void QgsLegend::openEditor()
@@ -1770,7 +1767,8 @@ void QgsLegend::removeSelectedLayers()
{
// Turn off rendering to improve speed.
bool renderFlagState = mMapCanvas->renderFlag();
mMapCanvas->setRenderFlag( false );
if ( renderFlagState )
mMapCanvas->setRenderFlag( false );

foreach( QTreeWidgetItem *item, selectedItems() )
{
@@ -1790,5 +1788,6 @@ void QgsLegend::removeSelectedLayers()
}

// Turn on rendering (if it was on previously)
mMapCanvas->setRenderFlag( renderFlagState );
if ( renderFlagState )
mMapCanvas->setRenderFlag( true );
}
@@ -3544,7 +3544,7 @@ void QgisApp::showComposerManager()

void QgisApp::saveMapAsImage()
{
QPair< QString,QString> myFileNameAndFilter = QgisGui::getSaveAsImageName( this, tr( "Choose a file name to save the map image as" ) );
QPair< QString, QString> myFileNameAndFilter = QgisGui::getSaveAsImageName( this, tr( "Choose a file name to save the map image as" ) );
if ( myFileNameAndFilter.first != "" )
{
//save the mapview to the selected file
@@ -3606,10 +3606,12 @@ void QgisApp::toggleFullScreen()
// would otherwise cause two re-renders of the map, which can take a
// long time.
bool renderFlag = mapCanvas()->renderFlag();
mapCanvas()->setRenderFlag( false );
if ( renderFlag )
mapCanvas()->setRenderFlag( false );
showNormal();
showMaximized();
mapCanvas()->setRenderFlag( renderFlag );
if ( renderFlag )
mapCanvas()->setRenderFlag( true );
mPrevScreenModeMaximized = false;
}
else
@@ -4413,7 +4415,8 @@ void QgisApp::deselectAll()

// Turn off rendering to improve speed.
bool renderFlagState = mMapCanvas->renderFlag();
mMapCanvas->setRenderFlag( false );
if ( renderFlagState )
mMapCanvas->setRenderFlag( false );

QMap<QString, QgsMapLayer*> layers = QgsMapLayerRegistry::instance()->mapLayers();
for ( QMap<QString, QgsMapLayer*>::iterator it = layers.begin(); it != layers.end(); it++ )
@@ -4426,7 +4429,8 @@ void QgisApp::deselectAll()
}

// Turn on rendering (if it was on previously)
mMapCanvas->setRenderFlag( renderFlagState );
if ( renderFlagState )
mMapCanvas->setRenderFlag( true );
}

void QgisApp::addVertex()
@@ -313,7 +313,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
refresh();
}

} // addLayer
} // setLayerSet

void QgsMapCanvas::enableOverviewMode( QgsMapOverviewCanvas* overview )
{

0 comments on commit f0941dd

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