1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

QGIS独自のCursorの使用方法

Posted at

はじめに

QgsMapToolのCursorを情報参照表示などで使われているカーソルに変更したかったための備忘録

カーソル定義

カーソルはQgsApplicationクラスのCursorで7個定義されています。

ZoomIn Zoom in.
ZoomOut Zoom out.
Identify Identify: obtain information about the object.
CrossHair Precisely identify a point on the canvas.
CapturePoint Select and capture a point or a feature.
Select Select a rectangle.
Sampler Color/Value picker.

取得方法

カーソルの定義からのQCursorの取得もQgsApplicationクラスのgetThemeCursorを使うことで取得できます。

cursor = QgsApplication.getThemeCursor(QgsApplication.Identify)

例: MapToolのCursorを変更する

tool = QgsMapToolIdentifyFeature(iface.mapCanvas())
cursor = QgsApplication.getThemeCursor(QgsApplication.Identify)
tool.setCursor(cursor)

参考

QgsApplicatoin::Cursor
QgsApplication::getThemeCursor

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?