Is it possible to create "rotate canvas" shortcuts in QGIS? I'm thinking about something like "Ctrl + mouse scroll up" to rotate the canvas clockwise and "Ctrl + mouse scroll down" to rotate the canvas counter clockwise...
To rotate the canvas and assign a shortcut using Python, you could use something like the following which you could paste into the Python Console:
from PyQt4.QtGui import QShortcut, QKeySequence from PyQt4.QtCore import Qt def rot_clock(): # Rotate clockwise by 10 degrees rot = qgis.utils.iface.mapCanvas().rotation() qgis.utils.iface.mapCanvas().setRotation(rot + 10) def rot_anticlock(): # Rotate anti-clockwise by 10 degrees rot = qgis.utils.iface.mapCanvas().rotation() qgis.utils.iface.mapCanvas().setRotation(rot - 10) # Assign shortcut to "Ctrl + K" rotate_clock = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_K), iface.mainWindow()) rotate_clock.setContext(Qt.ApplicationShortcut) rotate_clock.activated.connect(rot_clock) # Assign shortcut to "Ctrl + L" rotate_anti = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_L), iface.mainWindow()) rotate_anti.setContext(Qt.ApplicationShortcut) rotate_anti.activated.connect(rot_anticlock)
If you want to assign it to the mouse wheel, you could look into the QWheelEvent class and try to incorporate that into the code above.
There's similar functionality, in QGIS 2.16.3, at least.
Hover your mouse over the Rotation widget at the bottom of the screen, and roll the mouse up or down...
- roll up or down to rotate in 5 degree steps (up=clockwise, down=counter-clockwise)
- Hold Shift and roll for 50 degree steps
I can't see a way to do this when hovering over the canvas, as Settings > Configure Shortcuts doesn't include the rotate widget as a target, and the dialog only seems to support keyboard combinations. It might be possible using Python but not looked into that.