5

Is it possible to dock the attribute table using pyqgis? For instance, docking it to the bottom of the screen?

  • If using QGIS 2.x, then this post might be helpful: Displaying QGIS attribute table on the right. Simply replace Qt.RightDockWidgetArea with Qt.BottomDockWidgetArea :) – Joseph May 3 '18 at 12:39
  • @Joseph Thanks, do you know if it is possible to change the settings of QGIS through pyqgis as well? I would like it to work for more than just me. – Kasper Skjeggestad May 3 '18 at 12:47
  • 1
    was the question "docking the attribute table to the bottom of the screen" regardless of QGIS window's position ? :-p – snaileater May 3 '18 at 13:30
  • 1
    @snaileater I ment the bottom of QGIS window :P – Kasper Skjeggestad May 3 '18 at 13:44
8

There is the setting Open attribute table in a dock window which automatically opens the attribute table in the bottom dock window. You can set this manually via the menubar:

Settings > Options > Data Sources > Open attribute table in a dock window

Or via PyQGIS:

from PyQt4.QtCore import QSettings
QSettings().setValue("/Qgis/dockAttributeTable", True)
  • @KasperSkjeggestad - Most welcome! Glad it helped :) – Joseph May 3 '18 at 13:43
1

To do this in Qgis 3.x (expanding on the accepted answer by @Joseph), use:

from qgis.PyQt.QtCore import QSettings
QSettings().setValue("/Qgis/dockAttributeTable", True)

# And to check the current value of the setting
QSettings().value("/Qgis/dockAttributeTable")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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