3

Is there a way to hide all the fields at once in QGIS 1.7?

I see where I can hide one field at a time but I would like a button which does it all at once.

  • Do you mean field attributes displayed in a layer? Or 'layers'? – Simbamangu Oct 23 '12 at 11:14
3

with the GUI no but with a small Python script run in the Python console you can:

from qgis.utils import iface
layer = iface.activeLayer()
indexes = layer.pendingAllAttributesList()
for i in indexes:
      layer.setEditType(i, QgsVectorLayer.Hidden)

Copy and paste the following into the QGIS Python console and it should hide all the attributes on the layer.

  • What is the preferred way to save this bit of code in the interface somewhere? Or how easy is it to attach this to a ui button? I'd like to give a go at contributing to the project – Justin Oct 24 '12 at 11:47
  • @Nathan W- Has there been any GUI updates to bulk hide/show in 2.4? If not (for non-techies) what is the appropriate EditType to show the fields (opposite of QgsVectorLayer.Hidden)? – RyanDalton Jul 3 '14 at 20:03
  • Never mind about the code... I figured it out. To revert to the default setting, use: layer.setEditType(i, QgsVectorLayer.TextEdit). But is there a bulk on/off in the GUI? – RyanDalton Jul 3 '14 at 20:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.