Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I noticed that PyQGis has QgsMapToolPan() and QgsMapToolZoom() functions, and the cursor shape on the canvas will change to a hand (for pan), magnifying-glass(+/-) (for zoomIn / zoomOut).

I have a toolbar for Select (arrow icon), Marquee (bounding box icon), besides the Pan, ZoomIn and ZoomOut tool buttons.

Currently I created the Select & Marquee tools as QgsMapTool(canvas) and setAction with the appropriately ui widget buttons.

How can I change the cursor shape to arrow when the Select tool is activated, and cross when the Marquee tool is activated?

(I noted the default cursor shape for QgsMapTool() is Cross icon which I could use for the Marquee tool.)

share|improve this question
add comment

1 Answer 1

The mouse cursor can be controlled by calling the setCursor method of any QWidget:

from PyQt4.QtGui import *
from PyQt4.QtCore import *

cursor = QCursor()
cursor.setShape(Qt.WhatsThisCursor)
qgis.utils.iface.mainWindow().centralWidget().setCursor(cursor)

Or alternatively on the application level:

QApplication.instance().setOverrideCursor(cursor)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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