Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
    
Do you mean field attributes displayed in a layer? Or 'layers'? –  Simbamangu Oct 23 '12 at 11:14

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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 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 at 20:25

protected by underdark Jun 5 at 11:28

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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