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.

1
  • Do you mean field attributes displayed in a layer? Or 'layers'?
    – Simbamangu
    Commented Oct 23, 2012 at 11:14

1 Answer 1

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.

3
  • 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
    Commented Oct 24, 2012 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)? Commented Jul 3, 2014 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? Commented Jul 3, 2014 at 20:25

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