6

Is it possible to set the default dock position for the attribute table? I have a pretty long list of fields and 1-N relations to be displayed. Now I need to always drag and drop the window and I was wondering if it is possible to avoid it and have it always on the right.

enter image description here

2
  • Do you want to display "one" or "multiple" attribute tables at a time? Commented Feb 20, 2021 at 12:24
  • One table at a time. If I right-click a layer and select show attribute table, I want it to be the dock to the right
    – Nil
    Commented Feb 20, 2021 at 14:59

1 Answer 1

11

I don't think there is an option for this yet. But you can make a simple tool which opens the table on the right. Run the script in QGIS Python Editor. It adds a toolbar containing a tool.

def open_attr_table_on_the_right():
    attr_table = iface.showAttributeTable(iface.activeLayer())
    widgets = QApplication.instance().allWidgets()
    attrTables = [t for t in widgets if t.objectName() == u'AttributeTable']
    for table in attrTables:
        iface.addDockWidget(Qt.RightDockWidgetArea, table)

action = QAction("Open A.T.")
action.triggered.connect(open_attr_table_on_the_right)
new_toolbar = iface.addToolBar("Open Attribute Table")
new_toolbar.addAction(action)

This script displays a newly opened table on the right and moves other attribute tables already opened to the right.

enter image description here

1
  • I have to say it is so cool!
    – Nil
    Commented Feb 20, 2021 at 15:45

Your Answer

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

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