Is there a keyboard shortcut, or even something like a toolbar button, which would make it easier and quicker to open (and close) the layers panel in QGIS (2.6).
I don't see one listed under the keyboard shortcuts list.
It's not built in (yet. I might just put it on my todo xmas list) however you can use some Python to do this:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
dock = iface.mainWindow().findChild(QDockWidget, "Layers")
def activated():
visible = dock.isVisible()
dock.setVisible(not visible)
short = QShortcut(QKeySequence(Qt.ALT + Qt.Key_1), iface.mainWindow())
short.setContext(Qt.ApplicationShortcut)
short.activated.connect(activated)
To have this always on you can add it to .qgis2\python\setup.py
and it will be run each time QGIS starts.
Here is some code you can add to your startup.py
in order to control bindings
from functools import partial
from qgis.utils import iface
from PyQt4.QtCore import *
from PyQt4.QtGui import *
mappings = {"Layers": Qt.ALT + Qt.Key_1,
"Browser": Qt.ALT + Qt.Key_2,
"PythonConsole": Qt.ALT + Qt.Key_3}
shortcuts = []
def activated(dock):
dock = iface.mainWindow().findChild(QDockWidget, dock)
visible = dock.isVisible()
dock.setVisible(not visible)
def bind():
for dock, keys in mappings.iteritems():
short = QShortcut(QKeySequence(keys), iface.mainWindow())
short.setContext(Qt.ApplicationShortcut)
short.activated.connect(partial(activated, dock))
shortcuts.append(short)
bind()
This will take all the mappings and create shortcuts for them. Nifty!
unexpected intend
in line 1.
If you're using Ubuntu, the commands found in the QGIS menu are accessible via heads-up-display (HUD).
To show / hide the layers panel, or the browser panel for example:
The layers panel will show/hide
Similarily, you can access any tool that can be accessed from the menu panel of QGIS, such as the buffer tool, and the MMQGIS buffer tool:
I have not come across such a shortcut, but rightclicking on an empty part of the toolbar area lets you easily activate or deactivate panels and toolbars.
I guess it would not be too difficult to write a python plugin with its own icon for your task.