Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Appied patch in ticket #811 from aaronr
git-svn-id: http://svn.osgeo.org/qgis/trunk@7416 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Nov 16, 2007
1 parent b023826 commit bd3fd85
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
17 changes: 11 additions & 6 deletions src/app/legend/qgslegendlayerfile.cpp
Expand Up @@ -62,12 +62,17 @@ QgsLegendLayerFile::QgsLegendLayerFile(QTreeWidgetItem * theLegendItem, QString
setCheckState(0, Qt::Checked);
setText(0, theString);

// get notifications of changed selection - used to update attribute table
connect(mLyr.layer(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

// get notifications of modified layer - used to close table as it's out of sync
connect(mLyr.layer(), SIGNAL(wasModified(bool)), this, SLOT(closeTable(bool)));

// Add check if vector layer when connecting to selectionChanged slot
// Ticket #811 - racicot
QgsMapLayer *currentLayer = mLyr.layer();
QgsVectorLayer *isVectLyr = dynamic_cast < QgsVectorLayer * >(currentLayer);
if (isVectLyr)
{
// get notifications of changed selection - used to update attribute table
connect(mLyr.layer(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
// get notifications of modified layer - used to close table as it's out of sync
connect(mLyr.layer(), SIGNAL(wasModified(bool)), this, SLOT(closeTable(bool)));
}
connect(mLyr.layer(), SIGNAL(layerNameChanged()), this, SLOT(layerNameChanged()));
}

Expand Down
22 changes: 18 additions & 4 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -247,16 +247,30 @@ void QgsMapCanvas::setLayerSet(QList<QgsMapCanvasLayer>& layers)
{
for (i = 0; i < layerCount(); i++)
{
disconnect(getZpos(i), SIGNAL(repaintRequested()), this, SLOT(refresh()));
disconnect(getZpos(i), SIGNAL(selectionChanged()), this, SLOT(refresh()));
// Add check if vector layer when disconnecting from selectionChanged slot
// Ticket #811 - racicot
QgsMapLayer *currentLayer = getZpos(i);
disconnect(currentLayer, SIGNAL(repaintRequested()), this, SLOT(refresh()));
QgsVectorLayer *isVectLyr = dynamic_cast < QgsVectorLayer * >(currentLayer);
if (isVectLyr)
{
disconnect(currentLayer, SIGNAL(selectionChanged()), this, SLOT(refresh()));
}
}

mMapRender->setLayerSet(layerSet);

for (i = 0; i < layerCount(); i++)
{
connect(getZpos(i), SIGNAL(repaintRequested()), this, SLOT(refresh()));
connect(getZpos(i), SIGNAL(selectionChanged()), this, SLOT(refresh()));
// Add check if vector layer when connecting to selectionChanged slot
// Ticket #811 - racicot
QgsMapLayer *currentLayer = getZpos(i);
connect(currentLayer, SIGNAL(repaintRequested()), this, SLOT(refresh()));
QgsVectorLayer *isVectLyr = dynamic_cast < QgsVectorLayer * >(currentLayer);
if (isVectLyr)
{
connect(currentLayer, SIGNAL(selectionChanged()), this, SLOT(refresh()));
}
}
}

Expand Down

0 comments on commit bd3fd85

Please sign in to comment.