Macro Mouse Cross/cs: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(Updating to match new version of source page)
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
{{Macro/cs|Icon=Text-x-python|Name=Macro_Mouse_Cross|Name/cs=Macro Mouse Cross|Description=Toto malé makro mění šipku kurzoru myši na jemný křížek.|Shortcut="C" "A" |Author=Mario52|Version=00.03|Date=25/01/2016}}


<div class="mw-translate-fuzzy">
{{Macro/cs
|Name=Macro_Mouse_Cross
|Icon=Macro_Mouse_Cross.png
|Translate=Macro Mouse Cross
|Description=Toto malé makro mění šipku kurzoru myši na jemný křížek.
|Shortcut=C, A, G, X, Q
|Author=Mario52
|Version=0.05
|Date=2020-08-06
|FCVersion=0.18 and more
|Download=[https://www.freecadweb.org/wiki/images/f/ff/Macro_Mouse_Cross.png ToolBar icon]
}}
</div>

==Description==

<div class="mw-translate-fuzzy">
==Popis==
==Popis==
Toto malé makro mění šipku kurzoru myši na jemný křížek.<br />
Toto malé makro mění šipku kurzoru myši na jemný křížek.
</div>
Malý příklad použití třídy '''ViewObserver()''' a použití klávesnice '''[[Code_snippets#Observing_mouse_events_in_the_3D_viewer_via_Python|SoKeyboardEvent]]'''

[[File:Macro_Mouse_Cross_00.png|480px|Macro_Mouse_Cross]]
{{Caption|Malý příklad použití třídy '''ViewObserver()''' a použití klávesnice '''[[Code_snippets#Observing_mouse_events_in_the_3D_viewer_via_Python|SoKeyboardEvent]]'''}}

==Usage==

<div class="mw-translate-fuzzy">
==Použití==
# Stiskněte klávesu {{KEY|C}} pro aktivaci křížku.
# Stiskněte klávesu {{KEY|A}} pro aktivaci šipky.
# Stiskněte klávesu {{KEY|G}} pro aktivaci mřížky.
# Stiskněte klávesu {{KEY|X}} pro zobrazení všech kurzoru.
# Stiskněte klávesu {{KEY|Q}} pro ukončení makra.
</div>


<span id="Script"></span>
[[File:Macro_Mouse_Cross_00.png|480px|Macro_Mouse_Cross]] {{clear}}
==Skript==


ToolBar icon [[Image:Macro_Mouse_Cross.png]]
==How to use==
# Press the {{KEY|C}} button to activate the cross.
# Press the {{KEY|A}} button to activate the arrow.
# Press the {{KEY|G}} button to activate the grid.
# Press the {{KEY|X}} button for visualise all cursor.
# Press the {{KEY|Q}} button to quit the macro.


'''Macro_Mouse_Cross.FCMacro'''
===Skript===
Macro_Mouse_Cross.FCMacro


{{Code|code=
{{MacroCode|code=


# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# mouse cursor to Cross or Arrow + Grig
# mouse cursor to Cross or Arrow + Grig
# ver 0.2 08/08/2014 PyQt4 and PySide
# ver 0.2 08/08/2014 PyQt4 and PySide
# ver 0.4 07/06/2019 compatible Python 3.
# ver 0.5 06/08/2020 PySide2 and add image in macro
#
__title__ = "Macro_Mouse_Cross"
__title__ = "Macro_Mouse_Cross"
__author__ = "Mario52"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__wiki__ = "https://www.freecadweb.org/wiki/Macro_Mouse_Cross"
__url__ = "https://www.freecadweb.org/"
__version__ = "00.03"
__version__ = "0.05"
__date__ = "25/01/2016"
__date__ = "06/08/2020"


import PySide2
try:
from PyQt4 import QtCore, QtGui
from PySide2 import QtWidgets, QtCore, QtGui
from PySide2.QtGui import QColor, QPixmap, QImage, QPainter, QCursor
except Exception:
from PySide import QtCore, QtGui
from PySide2.QtCore import Qt,QUrl
from PySide2.QtWidgets import QApplication
from pivy import coin
from pivy import coin

FCCursor24x24_Icon = [
"24 24 9 1",
" c None",
". c #3A0202",
"+ c #0E1245",
"@ c #640A0A",
"# c #B10A0B",
"$ c #2A3E71",
"% c #DF1F20",
"& c #49699A",
"* c #638EC0",
".............. ",
".%%%%%%%%%%%%. ",
".%%%%%%%%%%%%. ",
".%%%%%%%%%%%%. ",
".%%%%%%%%%%%%. ",
".%%%%......... ",
".%%%%. ++++ ",
".%%%%. +**+ ",
".%%%%. +++ +**+ +++ ",
".%%%%.....**+****+**+ ",
".%%%%%%%%.**********+ ",
".%%%%%%%%.+********+ ",
".%%%%%%%%.***++++***+ ",
".%%%%%....**++ ++**+++ ",
".%%%%..+****+ +****+ ",
".%%%%. +****+ +****+ ",
".%%%%. +++**++ ++**+++ ",
".%%%%. +***++++***+ ",
".%%%%. +********+ ",
".%%%%. +**********+ ",
".%%%%. +**+****+**+ ",
".%%%%. +++ +**+ +++ ",
".%%%%. +**+ ",
"...... ++++ "
]


global xx ;xx = -1
global xx ;xx = -1
Line 46: Line 115:
self.pos = info["Key"]
self.pos = info["Key"]
if (self.pos.upper() == "Q"):
if (self.pos.upper() == "Q"):
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
v.removeEventCallback("SoKeyboardEvent",c)
v.removeEventCallback("SoKeyboardEvent",c)
print "End Macro_Mouse_Cross"
FreeCAD.Console.PrintMessage("End Macro_Mouse_Cross"+"\n")
if (self.pos.upper() == "C"):
if (self.pos.upper() == "C"):
# change the cursor cross ( + )
# change the cursor cross ( + )
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
elif (self.pos.upper() == "A"):
elif (self.pos.upper() == "A"):
# change the cursor in Arrow
# change the cursor in Arrow
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
elif (self.pos.upper() == "X") and (info["State"] == "DOWN"):
elif (self.pos.upper() == "X") and (info["State"] == "DOWN"):
# change the cursor and visualise all model
# change the cursor and visualise all model
xx += 1
xx += 1
if xx == 0:
if xx == 0:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
FreeCAD.Console.PrintMessage("ArrowCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : ArrowCursor"+"\n")
if xx == 1:
if xx == 1:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.UpArrowCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.UpArrowCursor))
FreeCAD.Console.PrintMessage("UpArrowCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : UpArrowCursor"+"\n")
if xx == 2:
if xx == 2:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
FreeCAD.Console.PrintMessage("CrossCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : CrossCursor"+"\n")
if xx == 3:
if xx == 3:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
FreeCAD.Console.PrintMessage("WaitCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : WaitCursor"+"\n")
if xx == 4:
if xx == 4:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
FreeCAD.Console.PrintMessage("IBeamCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : IBeamCursor"+"\n")
if xx == 5:
if xx == 5:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor))
FreeCAD.Console.PrintMessage("SizeVerCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : SizeVerCursor"+"\n")
if xx == 6:
if xx == 6:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor))
FreeCAD.Console.PrintMessage("SizeHorCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : SizeHorCursor"+"\n")
if xx == 7:
if xx == 7:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeBDiagCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeBDiagCursor))
FreeCAD.Console.PrintMessage("SizeBDiagCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : SizeBDiagCursor"+"\n")
if xx == 8:
if xx == 8:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))
FreeCAD.Console.PrintMessage("SizeFDiagCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : SizeFDiagCursor"+"\n")
if xx == 9:
if xx == 9:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeAllCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeAllCursor))
FreeCAD.Console.PrintMessage("SizeAllCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : SizeAllCursor"+"\n")
if xx == 10:
if xx == 10:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
FreeCAD.Console.PrintMessage("BlankCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : BlankCursor"+"\n")
if xx == 11:
if xx == 11:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SplitVCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SplitVCursor))
FreeCAD.Console.PrintMessage("SplitVCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : SplitVCursor"+"\n")
if xx == 12:
if xx == 12:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SplitHCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SplitHCursor))
FreeCAD.Console.PrintMessage("SplitHCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : SplitHCursor"+"\n")
if xx == 13:
if xx == 13:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
FreeCAD.Console.PrintMessage("PointingHandCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : PointingHandCursor"+"\n")
if xx == 14:
if xx == 14:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ForbiddenCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ForbiddenCursor))
FreeCAD.Console.PrintMessage("ForbiddenCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : ForbiddenCursor"+"\n")
if xx == 15:
if xx == 15:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor))
FreeCAD.Console.PrintMessage("OpenHandCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : OpenHandCursor"+"\n")
if xx == 16:
if xx == 16:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ClosedHandCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ClosedHandCursor))
FreeCAD.Console.PrintMessage("ClosedHandCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : ClosedHandCursor"+"\n")
if xx == 17:
if xx == 17:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
FreeCAD.Console.PrintMessage("WhatsThisCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : WhatsThisCursor"+"\n")
if xx == 18:
if xx == 18:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.BusyCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.BusyCursor))
FreeCAD.Console.PrintMessage("BusyCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : BusyCursor"+"\n")
if xx == 19:
if xx == 19:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.BitmapCursor))
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QPixmap(FCCursor24x24_Icon))) # image include in macro
#QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QPixmap("C:/completePath/image.png"))) # image to disk
FreeCAD.Console.PrintMessage("BitmapCursor"+"\n")
FreeCAD.Console.PrintMessage(str(xx)+" : FCCursor24x24_Icon"+"\n")
xx = -1
xx = -1
elif (self.pos.upper() == "G"):
elif (self.pos.upper() == "G"):
Line 123: Line 194:
grid=coin.SoType.fromName("SoDrawingGrid").createInstance()
grid=coin.SoType.fromName("SoDrawingGrid").createInstance()
Gui.ActiveDocument.ActiveView.getSceneGraph().addChild(grid)
Gui.ActiveDocument.ActiveView.getSceneGraph().addChild(grid)

xx = -1
xx = -1


Line 136: Line 208:
except Exception:
except Exception:
FreeCAD.Console.PrintError("\n"+"Not document open"+"\n")
FreeCAD.Console.PrintError("\n"+"Not document open"+"\n")



}}
}}

<span id="Cursors_that_can_be_used"></span>
===Kurzory, které mohou být používány===
===Kurzory, které mohou být používány===

ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, IBeamCursor, SizeVerCursor, SizeHorCursor
ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, IBeamCursor, SizeVerCursor, SizeHorCursor
SizeBDiagCursor, SizeFDiagCursor, SizeAllCursor, BlankCursor, SplitVCursor, SplitHCursor
SizeBDiagCursor, SizeFDiagCursor, SizeAllCursor, BlankCursor, SplitVCursor, SplitHCursor
PointingHandCursor, ForbiddenCursor, OpenHandCursor, ClosedHandCursor, WhatsThisCursor, BusyCursor, BitmapCursor
PointingHandCursor, ForbiddenCursor, OpenHandCursor, ClosedHandCursor, WhatsThisCursor, BusyCursor, BitmapCursor


==Limitation==
==Limitations==
The cursor can change appearance depending on the used Workbench, he must repeat the operation.<br />
The cursor can be subtituer to the other sliders (ex: expansion of a window, corner...).<br />
The grid is permanent.<br />


<div class="mw-translate-fuzzy">
<languages/>
==Omezení==
Kurzor může měnit vzhled v závislosti na používané pracovní ploše, musí opakovat funkci.<br />
Kurzor může být nahrazen jiným posuvníkem (např. rozšíření okna, rohu, ...).<br />
Mřížka je permanentní.<br />
Zbytek rezidentního makra.
</div>

Latest revision as of 22:09, 29 December 2023

Macro Mouse Cross

Popis
Toto malé makro mění šipku kurzoru myši na jemný křížek.

Version macro : 0.05
Date last modification : 2020-08-06
FreeCAD version : 0.18 and more
Download : ToolBar icon
Autor: Mario52
Autor
Mario52
Download
ToolBar icon
Odkazy
Verze
0.05
Datum poslední úpravy
2020-08-06
Verze FreeCAD
0.18 and more
Výchozí zástupce
C, A, G, X, Q
Viz též
None

Description

Popis

Toto malé makro mění šipku kurzoru myši na jemný křížek.

Macro_Mouse_Cross

Malý příklad použití třídy ViewObserver() a použití klávesnice SoKeyboardEvent

Usage

Použití

  1. Stiskněte klávesu C pro aktivaci křížku.
  2. Stiskněte klávesu A pro aktivaci šipky.
  3. Stiskněte klávesu G pro aktivaci mřížky.
  4. Stiskněte klávesu X pro zobrazení všech kurzoru.
  5. Stiskněte klávesu Q pro ukončení makra.

Skript

ToolBar icon

Macro_Mouse_Cross.FCMacro

# -*- coding: utf-8 -*-
# mouse cursor to Cross or Arrow + Grig 
# ver 0.2 08/08/2014  PyQt4 and PySide
# ver 0.4 07/06/2019 compatible Python 3.
# ver 0.5 06/08/2020 PySide2 and add image in macro
#
__title__   = "Macro_Mouse_Cross"
__author__  = "Mario52"
__wiki__    = "https://www.freecadweb.org/wiki/Macro_Mouse_Cross"
__url__     = "https://www.freecadweb.org/"
__version__ = "0.05"
__date__    = "06/08/2020"

import PySide2
from PySide2 import QtWidgets, QtCore, QtGui
from PySide2.QtGui import QColor, QPixmap, QImage, QPainter, QCursor
from PySide2.QtCore import Qt,QUrl
from PySide2.QtWidgets import QApplication
from pivy import coin

FCCursor24x24_Icon = [
"24 24 9 1",
" 	c None",
".	c #3A0202",
"+	c #0E1245",
"@	c #640A0A",
"#	c #B10A0B",
"$	c #2A3E71",
"%	c #DF1F20",
"&	c #49699A",
"*	c #638EC0",
"..............          ",
".%%%%%%%%%%%%.          ",
".%%%%%%%%%%%%.          ",
".%%%%%%%%%%%%.          ",
".%%%%%%%%%%%%.          ",
".%%%%.........          ",
".%%%%.       ++++       ",
".%%%%.       +**+       ",
".%%%%.   +++ +**+ +++   ",
".%%%%.....**+****+**+   ",
".%%%%%%%%.**********+   ",
".%%%%%%%%.+********+    ",
".%%%%%%%%.***++++***+   ",
".%%%%%....**++  ++**+++ ",
".%%%%..+****+    +****+ ",
".%%%%. +****+    +****+ ",
".%%%%. +++**++  ++**+++ ",
".%%%%.   +***++++***+   ",
".%%%%.    +********+    ",
".%%%%.   +**********+   ",
".%%%%.   +**+****+**+   ",
".%%%%.   +++ +**+ +++   ",
".%%%%.       +**+       ",
"......       ++++       "
]

global xx ;xx = -1

#################### create document if not exist #######################
doc = FreeCAD.ActiveDocument                                         ####
if doc == None:                                                      ####
    doc = FreeCAD.newDocument()                                      ####
#########################################################################
class ViewObserver:
   def logPosition(self, info):
       global xx
       self.pos = info["Key"]
       if (self.pos.upper() == "Q"):
           QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
           v.removeEventCallback("SoKeyboardEvent",c)
           FreeCAD.Console.PrintMessage("End Macro_Mouse_Cross"+"\n")
       if (self.pos.upper() == "C"):
           # change the cursor cross ( + )
           QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
       elif (self.pos.upper() == "A"):
           # change the cursor in Arrow
           QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
       elif (self.pos.upper() == "X") and (info["State"] == "DOWN"):
           # change the cursor and visualise all model 
           xx += 1
           if xx == 0:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : ArrowCursor"+"\n")
           if xx == 1:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.UpArrowCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : UpArrowCursor"+"\n")
           if xx == 2:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : CrossCursor"+"\n")
           if xx == 3:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : WaitCursor"+"\n")
           if xx == 4:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : IBeamCursor"+"\n")
           if xx == 5:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : SizeVerCursor"+"\n")
           if xx == 6:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeHorCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : SizeHorCursor"+"\n")
           if xx == 7:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeBDiagCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : SizeBDiagCursor"+"\n")
           if xx == 8:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : SizeFDiagCursor"+"\n")
           if xx == 9:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SizeAllCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : SizeAllCursor"+"\n")
           if xx == 10:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : BlankCursor"+"\n")
           if xx == 11:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SplitVCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : SplitVCursor"+"\n")
           if xx == 12:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.SplitHCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : SplitHCursor"+"\n")
           if xx == 13:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : PointingHandCursor"+"\n")
           if xx == 14:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ForbiddenCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : ForbiddenCursor"+"\n")
           if xx == 15:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : OpenHandCursor"+"\n")
           if xx == 16:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ClosedHandCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : ClosedHandCursor"+"\n")
           if xx == 17:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : WhatsThisCursor"+"\n")
           if xx == 18:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.BusyCursor))
               FreeCAD.Console.PrintMessage(str(xx)+" : BusyCursor"+"\n")
           if xx == 19:
               QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QPixmap(FCCursor24x24_Icon))) # image include in macro
               #QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QPixmap("C:/completePath/image.png"))) # image to disk
               FreeCAD.Console.PrintMessage(str(xx)+" : FCCursor24x24_Icon"+"\n")
               xx = -1
       elif (self.pos.upper() == "G"):
           # "wmayer" http://forum.freecadweb.org/viewtopic.php?f=3&t=1065&hilit=cross#p8818
           # Create Grida
           grid=coin.SoType.fromName("SoDrawingGrid").createInstance()
           Gui.ActiveDocument.ActiveView.getSceneGraph().addChild(grid)

xx = -1 

try:
    v=Gui.activeDocument().activeView()
    o = ViewObserver()
    c = v.addEventCallback("SoKeyboardEvent",o.logPosition)
    App.Console.PrintMessage("Type Key C to Cross"+"\n")
    App.Console.PrintMessage("Type Key A to Arrow"+"\n")
    App.Console.PrintMessage("Type Key X to Visualise all cursor"+"\n")
    App.Console.PrintMessage("Type Key G to Grid (not editable)"+"\n")
    App.Console.PrintMessage("Type Key Q to Quit"+"\n")
except Exception:
    FreeCAD.Console.PrintError("\n"+"Not document open"+"\n")

Kurzory, které mohou být používány

ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, IBeamCursor, SizeVerCursor, SizeHorCursor SizeBDiagCursor, SizeFDiagCursor, SizeAllCursor, BlankCursor, SplitVCursor, SplitHCursor PointingHandCursor, ForbiddenCursor, OpenHandCursor, ClosedHandCursor, WhatsThisCursor, BusyCursor, BitmapCursor

Limitations

Omezení

Kurzor může měnit vzhled v závislosti na používané pracovní ploše, musí opakovat funkci.
Kurzor může být nahrazen jiným posuvníkem (např. rozšíření okna, rohu, ...).
Mřížka je permanentní.
Zbytek rezidentního makra.