1

I am trying to change the shortcut key cntrl + j (which is standard) to for example q, in the settings I see its changed but in the Attribute table where I want to use it to select a row and then zoom to selection its not working, cntrl + j is working.

How can I change this and use a different shortcut key?

2

The shortcuts from settings only applies to the main QGIS window. Other windows (i.e. the attribute table) have their own shortcuts assigned. I don't think this can be changed from the GUI but you can using a bit of Python.

Load the attribute table(s) and then open up the Python Console from the main QGIS window (Ctrl + P). Then use something like the following:

from PyQt4.QtGui import QApplication, QKeySequence
from PyQt4.QtCore import Qt

attrTables = [d for d in QApplication.instance().allWidgets() if d.objectName() == u'QgsAttributeTableDialog' or d.objectName() == u'AttributeTable' ]
for tables in attrTables:
    for x in tables.children():
        if x.objectName() == 'mActionZoomMapToSelectedRows':
            x.setShortcut(QKeySequence(Qt.Key_Q))
            x.setToolTip('Zoom map to the selected rows (Q)')

Now you should be able to zoom to the selected feature using Q.

Note: this will no longer work if the attribute table is closed.

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.