7

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

Joseph
76.7k8 gold badges173 silver badges286 bronze badges
asked May 3, 2018 at 12:30
4
  • 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 :) Commented May 3, 2018 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. Commented May 3, 2018 at 12:47
  • 1
    was the question "docking the attribute table to the bottom of the screen" regardless of QGIS window's position ? :-p Commented May 3, 2018 at 13:30
  • 1
    @snaileater I ment the bottom of QGIS window :P Commented May 3, 2018 at 13:44

2 Answers 2

12

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)
answered May 3, 2018 at 12:56
1
  • @KasperSkjeggestad - Most welcome! Glad it helped :) Commented May 3, 2018 at 13:43
2

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")
answered Apr 29, 2019 at 15:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.