I've got a plugin where I load some layers. After the last layer loaded, I show the attribute table.
However, I would like to select the form view and not the table view (see image).
How can I do this in Python?
Attribute table layout options
1 Answer 1
On QGIS v.2.6 you can open the Attribute table in form view (attribute editor) mode, this way:
- Load a layer into QGIS and make it active (that is, click on its name in the ToC).
- Open the QGIS Python console.
Paste the following code snippet there:
from qgis.gui import QgsDualView dv = QgsDualView() dv.init( iface.activeLayer(), iface.mapCanvas() ) dv.setView( QgsDualView.AttributeEditor ) dv.show()
And you get (yeah, I know it lacks the toolbar at the top, but that's the most you can get from PyQGIS :D) this:
enter image description here