Skip to content

Commit c49e70e

Browse files
committedDec 13, 2016
Fix DB manager layer preview after my QgsMapCanvas changes
1 parent e59bad5 commit c49e70e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎python/plugins/db_manager/layer_preview.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from qgis.PyQt.QtGui import QColor, QCursor
2525
from qgis.PyQt.QtWidgets import QApplication
2626

27-
from qgis.gui import QgsMapCanvas, QgsMapCanvasLayer, QgsMessageBar
27+
from qgis.gui import QgsMapCanvas, QgsMessageBar
2828
from qgis.core import QgsVectorLayer, QgsProject
2929

3030
from .db_plugins.plugin import Table
@@ -122,11 +122,11 @@ def _loadTablePreview(self, table, limit=False):
122122
QgsProject.instance().removeMapLayers([self.currentLayer.id()])
123123

124124
if vl:
125-
self.setLayerSet([QgsMapCanvasLayer(vl)])
125+
self.setLayers([vl])
126126
QgsProject.instance().addMapLayers([vl], False)
127127
self.zoomToFullExtent()
128128
else:
129-
self.setLayerSet([])
129+
self.setLayers([])
130130

131131
self.currentLayer = vl
132132

4 commit comments

Comments
 (4)

nirvn commented on Dec 14, 2016

@nirvn
Contributor

@wonder-sk , hmm, I spotted something "interesting":

  • Create a blank project
  • Do not add any layer, but make sure the style manager is opened
  • Open the db manager, and locate a spacial layer (source type doesn't matter)
  • Open the preview section
  • Notice the style dock will a/ show the layer in its layer combo box, b/ set the symbology UI to the preview symbology used

wonder-sk commented on Dec 14, 2016

@wonder-sk
MemberAuthor

It was probably like that before, right? (and the same for the raster layer in georeferencer)

Style dock is probably using all layers from map layer registry (project), rather than just showing just the ones in the layer tree. Not many people know, but it is possible to have layers in map layer registry (project) without having them in layer tree. With the project refactoring, I hope this grey area will be gone - until recently the layers simply had to be added to projects otherwise e.g. rendering would not work at all...

nirvn commented on Dec 15, 2016

@nirvn
Contributor

@wonder-sk , I assume it was there before (never noticed it until yesterday).

NathanW2 commented on Dec 15, 2016

@NathanW2
Member
Please sign in to comment.