summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowscursor.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@digia.com>2014-07-04 15:05:12 +0200
committerAlessandro Portale <alessandro.portale@digia.com>2014-07-04 15:20:18 +0200
commit6577ac381e73b2ce3d57d2e8a39edb424ce9a52d (patch)
tree73c3d1de205dc1b40914bd7aa849f908a42fba0d /src/plugins/platforms/windows/qwindowscursor.cpp
parent14a80bd4df83e960de458403deaf895a3d2c8812 (diff)
Windows: Use native-looking drag cursors
QWindowsDrag::defaultCursor() used xpm-based cursors which are aliased, dark and not available in different sizes. This patch uses the new cursors from QWindowsCursor::customCursor for the drag cursors and gets the ignoreDragCursor from the system. If fetching the ignoreDragCursor cursor fails, we still fall back to the ignoreDragCursor.xpm. The other xpms were moved to QWindowsDrag::defaultCursor() for the WinCE or non-png case. Change-Id: If216ffc8c9cc134529b7addd0121857d41805eac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscursor.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp102
1 files changed, 101 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 021a1dfb02..8352dac0b6 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -303,6 +303,104 @@ QCursor QWindowsCursor::customCursor(Qt::CursorShape cursorShape)
0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f,
0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00};
+ static const char * const moveDragCursorXpmC[] = {
+ "11 20 3 1",
+ ". c None",
+ "a c #FFFFFF",
+ "X c #000000", // X11 cursor is traditionally black
+ "aa.........",
+ "aXa........",
+ "aXXa.......",
+ "aXXXa......",
+ "aXXXXa.....",
+ "aXXXXXa....",
+ "aXXXXXXa...",
+ "aXXXXXXXa..",
+ "aXXXXXXXXa.",
+ "aXXXXXXXXXa",
+ "aXXXXXXaaaa",
+ "aXXXaXXa...",
+ "aXXaaXXa...",
+ "aXa..aXXa..",
+ "aa...aXXa..",
+ "a.....aXXa.",
+ "......aXXa.",
+ ".......aXXa",
+ ".......aXXa",
+ "........aa."};
+
+ static const char * const copyDragCursorXpmC[] = {
+ "24 30 3 1",
+ ". c None",
+ "a c #000000",
+ "X c #FFFFFF",
+ "XX......................",
+ "XaX.....................",
+ "XaaX....................",
+ "XaaaX...................",
+ "XaaaaX..................",
+ "XaaaaaX.................",
+ "XaaaaaaX................",
+ "XaaaaaaaX...............",
+ "XaaaaaaaaX..............",
+ "XaaaaaaaaaX.............",
+ "XaaaaaaXXXX.............",
+ "XaaaXaaX................",
+ "XaaXXaaX................",
+ "XaX..XaaX...............",
+ "XX...XaaX...............",
+ "X.....XaaX..............",
+ "......XaaX..............",
+ ".......XaaX.............",
+ ".......XaaX.............",
+ "........XX...aaaaaaaaaaa",
+ ".............aXXXXXXXXXa",
+ ".............aXXXXXXXXXa",
+ ".............aXXXXaXXXXa",
+ ".............aXXXXaXXXXa",
+ ".............aXXaaaaaXXa",
+ ".............aXXXXaXXXXa",
+ ".............aXXXXaXXXXa",
+ ".............aXXXXXXXXXa",
+ ".............aXXXXXXXXXa",
+ ".............aaaaaaaaaaa"};
+
+ static const char * const linkDragCursorXpmC[] = {
+ "24 30 3 1",
+ ". c None",
+ "a c #000000",
+ "X c #FFFFFF",
+ "XX......................",
+ "XaX.....................",
+ "XaaX....................",
+ "XaaaX...................",
+ "XaaaaX..................",
+ "XaaaaaX.................",
+ "XaaaaaaX................",
+ "XaaaaaaaX...............",
+ "XaaaaaaaaX..............",
+ "XaaaaaaaaaX.............",
+ "XaaaaaaXXXX.............",
+ "XaaaXaaX................",
+ "XaaXXaaX................",
+ "XaX..XaaX...............",
+ "XX...XaaX...............",
+ "X.....XaaX..............",
+ "......XaaX..............",
+ ".......XaaX.............",
+ ".......XaaX.............",
+ "........XX...aaaaaaaaaaa",
+ ".............aXXXXXXXXXa",
+ ".............aXXXaaaaXXa",
+ ".............aXXXXaaaXXa",
+ ".............aXXXaaaaXXa",
+ ".............aXXaaaXaXXa",
+ ".............aXXaaXXXXXa",
+ ".............aXXaXXXXXXa",
+ ".............aXXXaXXXXXa",
+ ".............aXXXXXXXXXa",
+ ".............aaaaaaaaaaa"};
+
switch (cursorShape) {
case Qt::SplitVCursor:
return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 32, vsplit_bits, vsplitm_bits);
@@ -313,9 +411,11 @@ QCursor QWindowsCursor::customCursor(Qt::CursorShape cursorShape)
case Qt::ClosedHandCursor:
return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 16, closedhand_bits, closedhandm_bits);
case Qt::DragCopyCursor:
+ return QCursor(QPixmap(copyDragCursorXpmC), 0, 0);
case Qt::DragMoveCursor:
+ return QCursor(QPixmap(moveDragCursorXpmC), 0, 0);
case Qt::DragLinkCursor:
- return QCursor(QGuiApplicationPrivate::instance()->getPixmapCursor(cursorShape), 0, 0);
+ return QCursor(QPixmap(linkDragCursorXpmC), 0, 0);
}
return QCursor();