Skip to content
Permalink
Browse files

Fix DB manager layer preview after my QgsMapCanvas changes

  • Loading branch information
wonder-sk committed Dec 13, 2016
1 parent e59bad5 commit c49e70ea0949d89a1a3b2485d67a1a7c3e85d476
Showing with 3 additions and 3 deletions.
  1. +3 −3 python/plugins/db_manager/layer_preview.py
@@ -24,7 +24,7 @@
from qgis.PyQt.QtGui import QColor, QCursor
from qgis.PyQt.QtWidgets import QApplication

from qgis.gui import QgsMapCanvas, QgsMapCanvasLayer, QgsMessageBar
from qgis.gui import QgsMapCanvas, QgsMessageBar
from qgis.core import QgsVectorLayer, QgsProject

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

if vl:
self.setLayerSet([QgsMapCanvasLayer(vl)])
self.setLayers([vl])
QgsProject.instance().addMapLayers([vl], False)
self.zoomToFullExtent()
else:
self.setLayerSet([])
self.setLayers([])

self.currentLayer = vl

4 comments on commit c49e70e

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn replied Dec 14, 2016

@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

This comment has been minimized.

Copy link
Member Author

@wonder-sk wonder-sk replied Dec 14, 2016

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

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn replied Dec 15, 2016

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

@NathanW2

This comment has been minimized.

Copy link
Member

@NathanW2 NathanW2 replied Dec 15, 2016

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