From e2d0bf2c3a8bc3b9cc37514b06f9518acf8a5be4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 27 Sep 2020 12:06:26 +0200 Subject: [PATCH] Sketcher: [skip ci] fix computing of hotspot of XPM icons on Windows/macOS Add a cross to copy and array icons. --- src/Mod/Sketcher/Gui/CommandSketcherTools.cpp | 44 +++++++++---------- src/Mod/Sketcher/Gui/DrawSketchHandler.cpp | 9 +++- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index 4ca161c820..d86661f786 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -1112,16 +1112,19 @@ static const char *cursor_createcopy[]={ "# c red", ". c None", "................................", + ".......+........................", + ".......+........................", + ".......+........................", + ".......+........................", + ".......+........................", "................................", + ".+++++...+++++..................", "................................", - "................................", - "................................", - "................................", - "................................", - "......................###.......", - "......................###.......", - "......................###.......", - "......................###.......", + ".......+........................", + ".......+..............###.......", + ".......+..............###.......", + ".......+..............###.......", + ".......+..............###.......", "......................###.......", ".....###..............###.......", ".....###..............###.......", @@ -1139,9 +1142,6 @@ static const char *cursor_createcopy[]={ "................................", "................................", "................................", - "................................", - "................................", - "................................", "................................"}; class DrawSketchHandlerCopy: public DrawSketchHandler @@ -1629,16 +1629,19 @@ static const char *cursor_createrectangulararray[]={ "# c red", ". c None", "................................", + ".......+........................", + ".......+........................", + ".......+........................", + ".......+........................", + ".......+........................", "................................", - "................................", - "................................", - "................................", + ".+++++...+++++..................", ".......................###......", - ".......................###......", - ".......................###......", - ".......................###......", - "..............###......###......", - "..............###......###......", + ".......+...............###......", + ".......+...............###......", + ".......+...............###......", + ".......+......###......###......", + ".......+......###......###......", "..............###......###......", "..............###......###......", ".....###......###......###......", @@ -1656,9 +1659,6 @@ static const char *cursor_createrectangulararray[]={ ".....###........................", ".....###........................", "................................", - "................................", - "................................", - "................................", "................................"}; class DrawSketchHandlerRectangularArray: public DrawSketchHandler diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index 0c0c10437b..1860bf934f 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -155,7 +155,14 @@ void DrawSketchHandler::setCursor(const QPixmap &p,int x,int y, bool autoScale) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) p1.setDevicePixelRatio(pRatio); #endif - cursor = QCursor(p1, x * pRatio, y * pRatio); +#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) + qreal hotX = x; + qreal hotY = y; +#else + qreal hotX = x * pRatio; + qreal hotY = y * pRatio; +#endif + cursor = QCursor(p1, hotX, hotY); } else { // already scaled cursor = QCursor(p1, x, y);