Navigation Menu

Skip to content

Commit

Permalink
Fix DB manager layer preview after my QgsMapCanvas changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Dec 13, 2016
1 parent e59bad5 commit c49e70e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/plugins/db_manager/layer_preview.py
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

4 comments on commit c49e70e

@nirvn
Copy link
Contributor

@nirvn nirvn commented on c49e70e Dec 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

@nirvn nirvn commented on c49e70e Dec 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@NathanW2
Copy link
Member

@NathanW2 NathanW2 commented on c49e70e Dec 15, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.